You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Tauren Mills (JIRA)" <ji...@apache.org> on 2010/03/02 03:36:06 UTC

[jira] Issue Comment Edited: (WICKET-2763) DateTimeField bug at the instant daylight savings time begins

    [ https://issues.apache.org/jira/browse/WICKET-2763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12839979#action_12839979 ] 

Tauren Mills edited comment on WICKET-2763 at 3/2/10 2:35 AM:
--------------------------------------------------------------

I believe the problem is in both convertInput() and in setDate().

In convertInput():

	date.set(DateTimeFieldType.hourOfDay(), hours.intValue() %
			getMaximumHours(use12HourFormat));

In setDate():

	this.date.set(DateTimeFieldType.hourOfDay(), hours.intValue() %
			(use12HourFormat ? 12 : 24));

The problem is that even if the time is 2:00PM, the hourOfDay field is set to 2 instead of 14.  The value of halfdayOfDay() is set afterwards. The hour 2 doesn't exist on 3/14/2010.  Because of this, the exception is thrown immediately when hourOfDay is set to 2.

I cannot override these methods with my own implementation because they both refer to private members that don't have getters or setters (hoursField, minutesField, amOrPmChoice, etc.)

The only solution would be to create my own copy of DateTimeField with the fixes.  I tried to fix it, and think I did in convertInput, but I'm having troubles with setDate(). If I figure it out, I'll post details.


      was (Author: tauren):
    I believe the problem is in both convertInput() and in setDate().

In convertInput():

	date.set(DateTimeFieldType.hourOfDay(), hours.intValue() %
			getMaximumHours(use12HourFormat));

In setDate():

	this.date.set(DateTimeFieldType.hourOfDay(), hours.intValue() %
			(use12HourFormat ? 12 : 24));

The problem is that even if the time is 2:00PM, the hourOfDay field is set to 2 instead of 14.  The value of halfdayOfDay() is set afterwards. The hour 2 doesn't exist on 3/14/2010.

I cannot override these methods with my own implementation because they both refer to private members that don't have getters or setters (hoursField, minutesField, amOrPmChoice, etc.)

The only solution would be to create my own copy of DateTimeField with the fixes.  I tried to fix it, and think I did in convertInput, but I'm having troubles with setDate(). If I figure it out, I'll post details.

  
> DateTimeField bug at the instant daylight savings time begins
> -------------------------------------------------------------
>
>                 Key: WICKET-2763
>                 URL: https://issues.apache.org/jira/browse/WICKET-2763
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-datetime
>    Affects Versions: 1.4.6
>            Reporter: Tauren Mills
>            Priority: Minor
>         Attachments: datetimefield_dst_bug.tgz
>
>
> I'm having troubles with an exception being thrown when using a DateTimeField.  This is only happening on 3/14/2010 when the Hour field contains a 2, regardless if it is AM or PM.  I believe this is related to daylight savings time starting at 2AM on 3/14/2010.
> Here is the exception:
> Caused by: org.joda.time.IllegalFieldValueException: Value 2 for hourOfDay is not supported: Illegal instant due to time zone offset transition: 2010-03-14T02:00:00.000 (America/Los_Angeles)
> 	at org.joda.time.chrono.ZonedChronology$ZonedDateTimeField.set(ZonedChronology.java:469)
> 	at org.joda.time.MutableDateTime.set(MutableDateTime.java:551)
> 	at org.apache.wicket.extensions.yui.calendar.DateTimeField.setDate(DateTimeField.java:236)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 	at java.lang.reflect.Method.invoke(Method.java:597)
> 	at org.apache.wicket.util.lang.PropertyResolver$MethodGetAndSet.setValue(PropertyResolver.java:1132)
> I'm running in the Pacific time zone (America/Los_angeles).  I'm attaching a quickstart to demonstrate.  Run the quickstart and do the following:
> 1. Go to http://localhost:8080/ and note that the date is 3/14/2010 at 2:00PM.
> 2. Click the Update button, and note the feedback message
> 3. Change the hour to 3 and click update, note the exception that is thrown
> 4. Change the date to any other date, and you can update the hour with no problems.
> I found a Joda post that might be related:
> http://n2.nabble.com/possible-bug-in-date-parsing-td2434227.html
> As far as I'm concerned, this is critical because my application is throwing errors if my users specify 2AM or 2PM times on that date.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.