Hello,
I have some problem with the DateItem Component.
The following code show a DateItem display and a button to show the selected date.
When I select (or type) a date before 1940, the SC say one day (1 hour?) before.
- 12/25/1912 => Tue Dec 24 23:00:00 CET 1912
- 1/1/1939 => Sat Dec 31 23:00:00 CET 1938
After 1940 no problems :
- 12/25/1983 => Sun Dec 25 00:00:00 CET 1983
- 1/1/2010 => Fri Jan 01 00:00:00 CET 2010
And finally the strange case of 1890 without problems:
- 1/1/1890 => Wed Jan 01 00:00:00 CET 1890
- 12/25/1890 => Thu Dec 25 00:00:00 CET 1890
Here is my simple onModuleLoad to test :
Leap years problem ?
Pierre
I have some problem with the DateItem Component.
The following code show a DateItem display and a button to show the selected date.
When I select (or type) a date before 1940, the SC say one day (1 hour?) before.
- 12/25/1912 => Tue Dec 24 23:00:00 CET 1912
- 1/1/1939 => Sat Dec 31 23:00:00 CET 1938
After 1940 no problems :
- 12/25/1983 => Sun Dec 25 00:00:00 CET 1983
- 1/1/2010 => Fri Jan 01 00:00:00 CET 2010
And finally the strange case of 1890 without problems:
- 1/1/1890 => Wed Jan 01 00:00:00 CET 1890
- 12/25/1890 => Thu Dec 25 00:00:00 CET 1890
Here is my simple onModuleLoad to test :
Code:
public void onModuleLoad() { final DateItem myDate = new DateItem(); myDate.setUseTextField(true); ButtonItem aff = new ButtonItem(); aff.setTitle("Show Date"); aff.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { SC.say("Date String :"+ (Date) myDate.getValue()); } }); DynamicForm df = new DynamicForm(); df.setFields(myDate, aff); df.draw(); }
Pierre
Comment