eclipse-ee4j / eclipse-ee4j/yasson
I-JSON date formatter is incorrect
- Dominant language
- Java
- Stars
- 218
- Forks
- 109
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 9
Description
**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.
Contributor guide
Research direction
The issue names Yasson's I-JSON date formatter and the config.withDateFormat(...) entry point, but no source file or test. Start by tracing that formatting path and reproduce the two RFC 7493 timestamps. Done means compliant timestamps with variable fractional-second lengths and either Z or numeric offsets parse without DateTimeParseExceptions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend-api-design
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100