1. #1
    Sencha User
    Join Date
    Jan 2012
    Location
    Chicago, IL USA
    Posts
    4
    Vote Rating
    0
    acrowley is on a distinguished road

      0  

    Default Unanswered: Forcing Datepicker to 4 digit year

    Unanswered: Forcing Datepicker to 4 digit year


    I have implemented the locale and my application now successfully formats the dates based on the locale loaded -> i.e. US : mm/dd/yy and SG: dd/mm/yy

    My next problem is to force this to use yyyy which doesnt seem to work by default using the locales. I would like to force my datepickers to return the proper Month/Day formatting as returned by the locale setup and use a 4 digit year.

    Any Ideas?

    Thanks again.

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Location
    Chicago, IL USA
    Posts
    4
    Vote Rating
    0
    acrowley is on a distinguished road

      0  

    Default


    In case anyone else runs into this issue here is what I did:

    Extended the DateField class with my own called oaDateField... here is the constructor (and all this class does):
    public oaDateField(){
    super();
    String format = this.getPropertyEditor().getFormat().getPattern();
    //force the 4 digit year
    if(format.indexOf("yyyy") == -1){
    format = format.replace("yy", "yyyy");
    }
    this.getPropertyEditor().setFormat(DateTimeFormat.getFormat(format));
    this.setFormatValue(true);
    }

    This will use my locale settings properly for the date and month, but continue to display using the yyyy year format.