1. #1
    Sencha User
    Join Date
    Sep 2013
    Posts
    14
    Answers
    1
    Vote Rating
    0
    samad.atoro is on a distinguished road

      0  

    Default Unanswered: GXT Date Format display issue

    Unanswered: GXT Date Format display issue


    Hello All. I updated GWT from 2.0.3 to 2.5.0 and GXT from 2.2.0 to 2.2.5. The date is set to display in long format. used to be September 27, 2013. But it now displays as 2013 September 2013. Any idea on where I can fix this? Thanks

  2. #2
    Sencha - GXT Dev Team
    Join Date
    Jan 2012
    Location
    Arlington, WA
    Posts
    364
    Answers
    6
    Vote Rating
    14
    branflake2267 will become famous soon enough

      0  

    Default


    Will this work or could you provide a sample of the code you are using to setup the format?

    Code:
    theDate.setFormat(DateTimeFormat.getFormat(PredefinedFormat.DATE_LONG));

  3. #3
    Sencha User
    Join Date
    Sep 2013
    Posts
    14
    Answers
    1
    Vote Rating
    0
    samad.atoro is on a distinguished road

      0  

    Default


    The code was
    Code:
    String dateStr = DateTimeFormat.getLongDateFormat().format(date);
    Since the getLongDateFormat() method is now deprecated, I changed it to
    Code:
    String dateStr = DateTimeFormat.getFormat(PredefinedFormat.DATE_LONG).format(currentlySelectedDate);
    But today's date still shows as 2013 September 27.
    Thanks

  4. #4
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,717
    Answers
    109
    Vote Rating
    89
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Samad.atoro, it looks as though the code changed slightly in terms of how locales work between 2.0 and current. The "default" locale uses "y MMMM d" for DATE_LONG, while "en" uses "MMMM d, y" which is what I think you are after. Can you confirm which locale you have configured?

  5. #5
    Sencha User
    Join Date
    Sep 2013
    Posts
    14
    Answers
    1
    Vote Rating
    0
    samad.atoro is on a distinguished road

      0  

    Default


    I will have to specify the format myself using "MMMM dd, yyyy"

    Thanks

  6. #6
    Sencha User
    Join Date
    Sep 2013
    Posts
    14
    Answers
    1
    Vote Rating
    0
    samad.atoro is on a distinguished road

      0  

    Default


    The default locale is en_US. I tried to manually specify the locale in the my .gwt.xml, but it complained about a reconfiguration of the locale. So looks like I could specify the locale to "en" and it will work? I will try.

  7. #7
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,717
    Answers
    109
    Vote Rating
    89
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Yes, specifying "en" should kick it to using the format string you are after (along with some changes to number that make it specific to the US anyway). There isn't a en_US as you've noticed, but instead en seems to be US specific.

  8. #8
    Sencha User
    Join Date
    Sep 2013
    Posts
    14
    Answers
    1
    Vote Rating
    0
    samad.atoro is on a distinguished road

      0  

    Default


    Colin, Thanks for your help. I inherited this code. So I'm having to read online articles and diging through the code to make sense of everything.

    I see this line in the home html page where the map is loaded.

    Code:
    <meta name="gwt:property" id="localeProperty" content="locale=en_US">
    I changed it to
    Code:
    <meta name="gwt:property" id="localeProperty" content="locale=en">
    I believe that it's expecting xx_YY format.

    I gave up on it for now and manually specified the format that I needed in the code. I will come back to this later as I'm facing a new issue. I just posted a new issue about my map displaying with the minimum size inside a ContentWidget panel. I will keep you posted once I figured out the locale issue. Thanks a lot
    I ended up