XStream
  1. XStream
  2. XSTR-159

DateConverter not storing TimeZone information.

    Details

    • Type: Bug Bug
    • Status: Closed 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[]

      { "yyyy-MM-dd HH:mm:ssa" }

      );
      }

      TO:
      public DateConverter() {
      this("yyyy-MM-dd HH:mm:ss.S z", new String[]

      { "yyyy-MM-dd HH:mm:ssz" }

      );
      }

        People

        • Assignee:
          Unassigned
          Reporter:
          Randy Secrist
        • Votes:
          0 Vote for this issue
          Watchers:
          0 Start watching this issue

          Dates

          • Created:
            Updated:
            Resolved: