Details
-
Type: Bug
-
Status: Closed
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.1
-
Component/s: None
-
Labels:None
Description
DateConverter does not (by default) properly store time zone information. The overall effect is a date serialized during daylight savings is not accurate when deserialized during standard time.
---- BEGIN EXAMPLE ----
The effect is illistrated as follows:
(format string) "EEEE, MMMM dd yyyy - hh:mm:ss.S a" (english locale)
on a new Date() (while in MDT)
will produce -
Wednesday, November 24 2004 - 10:38:52.236 AM (daylight savings)
however if you read this date after a switch to MST,
the date will parse as:
Wednesday, November 24 2004 - 10:38:52.236 AM
instead of:
Wednesday, November 24 2004 - 09:38:52.236 AM | MST
---- END EXAMPLE ----
Furthermore, the usage of HH in the format string makes the AM/PM redundant. To correct these problems, I suggest the following change be made to the default constructor of DateConverter:
FROM:
public DateConverter() {
this("yyyy-MM-dd HH:mm:ss.S a", new String[]
);
}
TO:
public DateConverter() {
this("yyyy-MM-dd HH:mm:ss.S z", new String[]
);
}
Good suggestion. I shall incorporate it in the next release.