Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix usage of non JSON numeric values for time fractions (without having precision issues) #706

Merged
merged 2 commits into from Mar 19, 2021

Commits on Mar 19, 2021

  1. Copy the full SHA
    ad4729f View commit details
    Browse the repository at this point in the history
  2. Fix usage of non JSON numeric values for time fractions

    The RFC-7519 states that the `NumericDate` type is:
    
    > JSON numeric value representing the number of seconds from
    > 1970-01-01T00:00:00Z UTC until the specified UTC date/time, ignoring
    > leap seconds.
    
    Then also mentions that time fractions (as covered by RFC-3339) are supported:
    
    > Seconds Since the Epoch", in which each day is accounted for by
    > exactly 86400 seconds, other than that non-integer values can be
    > represented.
    
    While adding support for time fractions we've interpreted the
    "non-integer" really as any "non-integer" value, and used strings to
    guard against precision issues.
    
    That causes issues, since a string isn't a "JSON numeric value"
    according to the JSON specs.
    
    We observed that the 6-digit precision is not lost when doing JSON
    encode/decode operations, this applies that technique to make sure we
    comply to the specs and have "rounding issues" when dealing with floats.
    yassinrais authored and lcobucci committed Mar 19, 2021
    Copy the full SHA
    9a961f4 View commit details
    Browse the repository at this point in the history