View Full Version : Issues with GXT Datefield
nagate
2 Oct 2008, 3:10 PM
I am using Gxt's Datefield widget and am running into couple of issues:
1) Cannot find a way to change the default format form mm/dd/yy to mm/dd/yyyy. Is this possible and if so how can I do it?
2) the getValue() method on Datefield return's incorrect value if I select a date less than 1927. Instead of the year 1927 it is returning 2027. Has this been already reported?
Thanks,
Ninad
mstguy01
3 Oct 2008, 6:50 AM
I am using Gxt's Datefield widget and am running into couple of issues:
1) Cannot find a way to change the default format form mm/dd/yy to mm/dd/yyyy. Is this possible and if so how can I do it?
getPropertyEditor() gives you a DateTimePropertyEditor which can be used to set the format you desire.
2) the getValue() method on Datefield return's incorrect value if I select a date less than 1927. Instead of the year 1927 it is returning 2027. Has this been already reported?
I don't see this behavior when I use it; what version of GXT are you using?
nagate
3 Oct 2008, 4:12 PM
Thanks by using DateTimePropertyEditor I was able to format the date.
The problem that I mentioned regarding dates less that 1927 was when I used the default DateTimeFormat, which was set to the MediumDateTimeFormat. And this was with GXT 1.0 build.
cravemusic
8 Oct 2008, 3:08 PM
2) the getValue() method on Datefield return's incorrect value if I select a date less than 1927. Instead of the year 1927 it is returning 2027. Has this been already reported?
This has to do with the selection of the proper year based on an 80/20 rule. If the two digit year will happen in the next 20 years, the current century is used, and if not, the last century is used. That is normal behavior in the Java Date API, and I think that's what the GXT developers intended. However, if explicitly using a 4 digit year format with the DateTimePropertyEditor, the 80/20 rule doesn't get obeyed. There is an bug open against this (http://extjs.com/forum/showthread.php?p=235917).
Powered by vBulletin® Version 4.1.5 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.