Uploaded image for project: 'Webservices REST Module'
  1. Webservices REST Module
  2. RESTWS-419

WS-REST date parsing not *quite* ISO 6801 compatible

    XMLWordPrintable

    Details

    • Complexity:
      Medium

      Description

      I found an annoyance with the parsing of the datetimes in WS-REST. Turns out that our parsing of dates isn't quite ISO 8601 compatible, because Java 6 SimpleDateFormat isn't quite ISO 6801 compatible.

      The problem with comes with the time zone component. In Java 6, SimpleDateFormat only supports the RFC 822 time zone format (-0800), while it turns out that the ISO 8601 format is a little more lenient (accepting -08 or -08:00 or -0800). As of Java 7, this format is supported.

      I discovered this when posting a date to a server with a different time zone that the client I was working on. I used the moment.js library to format the date, and used it's standard format, which created a date like this "2014-02-20T11:00:00.000-05:00". When parsing this date on the server side, it was dropping the time zone component, so if, for example, the server was in UTC, if I then fetched the same date, the server would send back "2014-02-20T11:00:00.000-0000".

      We should fix the parser to handle this. A quick hacky fix might be to do some some of regex that strips out any colon after a +/-?

        Attachments

          Activity

            People

            Assignee:
            bholagabbar Shreyans Sheth
            Reporter:
            mogoodrich Mark Goodrich
            Designated Committer:
            Mark Goodrich
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 1 day
                1d
                Remaining:
                Remaining Estimate - 1 day
                1d
                Logged:
                Time Spent - Not Specified
                Not Specified