We ran into a problem recently caused by the combination of:
upgrading to Usertype 3.1.0.CR8
the recent transition from Daylight Savings to Standard Time
The problem arose from the fact that in toNonNullValue(Date), DateTimeZone.getOffset() is called with a null value. This causes Joda time to calculate the offset based on DateTimeUtils.currentTimeMillis(). In our case, the LocalDate being written was Oct 31 2013, before the DST transition. The code was executing post-DST transition, and the offset is now one hour less than it was on Oct 31.
As a result, adjustment was 3600000 - exactly one hour. The resulting java.sql.Date instance was therefore computed as October 30 2013 -- one day before the argument date.
I believe the best way to correct this to pass the Date argument to DateTimeZone.getOffset(). This seems to have fixed the problem for us.
We ran into a problem recently caused by the combination of:
The problem arose from the fact that in
toNonNullValue(Date)
,DateTimeZone.getOffset()
is called with a null value. This causes Joda time to calculate the offset based onDateTimeUtils.currentTimeMillis()
. In our case, the LocalDate being written was Oct 31 2013, before the DST transition. The code was executing post-DST transition, and the offset is now one hour less than it was on Oct 31.As a result,
adjustment
was 3600000 - exactly one hour. The resulting java.sql.Date instance was therefore computed as October 30 2013 -- one day before the argument date.I believe the best way to correct this to pass the Date argument to
DateTimeZone.getOffset()
. This seems to have fixed the problem for us.PR coming shortly.