JiBX
  1. JiBX
  2. JIBX-373

Make JodaConvert.serializeZonedDateTime consistent

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Not A Bug
    • Affects Version/s: JiBX 1.2.2
    • Fix Version/s: None
    • Component/s: core
    • Labels:
      None
    • Number of attachments :
      0

      Description

      I would suggest that serializeZonedDateTime needs to be made consistent for all offsets.
      Currently, an offset of 0 will result in exactly the same output as serializeUTCDateTime

      DateTime dt = new DateTime().withZone(DateTimeZone.forOffsetHours(0));
      System.out.println(JodaConvert.serializeUTCDateTime(dt));
      System.out.println(JodaConvert.serializeZonedDateTime(dt));
      

      this will result in

      2010-04-16T09:26:40.42Z
      2010-04-16T09:26:40.42Z
      

      where I would have thought it should result in.

      2010-04-16T09:26:40.42Z
      2010-04-16T09:26:40.42+00:00
      

        Activity

        Hide
        Ben Davies added a comment -

        Sorry, raised as "Major" by accident, but it is obviously not.

        Show
        Ben Davies added a comment - Sorry, raised as "Major" by accident, but it is obviously not.
        Dennis Sosnoski made changes -
        Field Original Value New Value
        Assignee Dennis Sosnoski [ dsosnoski ]
        Hide
        Dennis Sosnoski added a comment -

        I started to implement this change, but after looking it over I'm not sure it's a good idea. The 'Z' offset is exactly equivalent to +/-00:00 in schema terms, and the 'Z' offset is both more compact and perhaps less confusing. I'm afraid that if I change to using +00:00 (or -00:00) I'll get complaints that input with 'Z' gets roundtripped with a different result.

        Is there some reason you prefer to see the +00:00 offset instead of 'Z'?

        Show
        Dennis Sosnoski added a comment - I started to implement this change, but after looking it over I'm not sure it's a good idea. The 'Z' offset is exactly equivalent to +/-00:00 in schema terms, and the 'Z' offset is both more compact and perhaps less confusing. I'm afraid that if I change to using +00:00 (or -00:00) I'll get complaints that input with 'Z' gets roundtripped with a different result. Is there some reason you prefer to see the +00:00 offset instead of 'Z'?
        Hide
        Ben Davies added a comment -

        Dennis,

        Fair enough.
        Your way is actually how Joda does it too, so maybe I was to hasty with this suggestion.
        Feel free to close.

        Cheers

        Show
        Ben Davies added a comment - Dennis, Fair enough. Your way is actually how Joda does it too, so maybe I was to hasty with this suggestion. Feel free to close. Cheers
        Ben Davies made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Not A Bug [ 6 ]
        Dennis Sosnoski made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Dennis Sosnoski
            Reporter:
            Ben Davies
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: