Skip to content

I-JSON date formatter is incorrect #384

@roysjosh

Description

@roysjosh

Describe the bug
Yasson does not properly implement the date/time format from RFC 7493 (and thus 3339). Specifically, RFC 3339 section 5.6 states that:

  1. partial-time contains an optional time-secfrac (a period followed by 1 or more digits)
  2. time-offset is either a literal Z or a time-numoffset but not both; the behavior to match seems to be the DateTimeFormatter pattern "XXX"

To Reproduce
Attempt to integrate with an API following RFC 7493. Example timestamps:

  • 2020-02-25T15:16:25.54249Z
  • 2020-02-24T17:38:12.8462945Z

Expected behavior
No DateTimeParseExceptions for compliant timestamps.

System information:

  • OS: macOS 10.15.3
  • Java Version: 11
  • Yasson Version: 1.0.6

Additional context
This was discovered while attempting to integrate with the MS Graph API which has a time-secfrac with a variable number of digits (but frequently 7 digits). Since yasson's I-JSON didn't work I tried config.withDateFormat("yyyy-MM-dd'T'HH:mm:ss[.SSSSSSS]XXX", Locale.getDefault()) which worked for a while until I got a timestamp with only 5 digits for time-secfrac.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions