-
-
Notifications
You must be signed in to change notification settings - Fork 215
Stricter time format constraints #481
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(edit.. that was a mispaste of something else)
We are failing on `Z+` not the invalid minute, so let's make sure that implementors are catching that case not the (mis-copy of 00:60).
I'll leave this open for a bit to give others a chance to weigh in, but this is really good, and you found some bugs in my implementation because I was being sloppy, so 🎉 👯 ❤️ |
Can someone elaborate a bit on the leap second thinking? I'm no RFC 3339 expert, but why is the leap second test valid? Whether a leap second is allowed depends on the leap second rules in the RFC yes? Which means knowing what day it is? What interpretation makes us say including one is always a valid instance? |
Without the date, all we can verify is that leap seconds can only occur just before midnight (UTC/Zulu). Technically any date in the future could have a leap second in it, since leap seconds are often only announced just before they happen. But without any date at all, all we know is this could describe a real point in time, therefore it's not invalid. |
Exposed by: json-schema-org/JSON-Schema-Test-Suite#481 Ruby incorrectly allows `24` as the hour in an RFC3339 timestamp. It also does not handle leap seconds very well: ``` -> Time.parse("23:59:60Z") => 2021-10-18 00:00:00 UTC ``` They should only be allowed at 23:59 UTC.
Exposed by: json-schema-org/JSON-Schema-Test-Suite#481 Ruby incorrectly allows `24` as the hour in an RFC3339 timestamp. It also does not handle leap seconds very well: ``` -> Time.parse("23:59:60Z") => 2021-10-18 00:00:00 UTC ``` They should only be allowed at 23:59 UTC.
Exposed by: json-schema-org/JSON-Schema-Test-Suite#481 Ruby incorrectly allows `24` as the hour in an RFC3339 timestamp. It also does not handle leap seconds very well: ``` -> Time.parse("23:59:60Z") => 2021-10-18 00:00:00 UTC ``` They should only be allowed at 23:59 UTC.
Exposed by: json-schema-org/JSON-Schema-Test-Suite#481 Ruby incorrectly allows `24` as the hour in an RFC3339 timestamp. It also does not handle leap seconds very well: ``` -> Time.parse("23:59:60Z") => 2021-10-18 00:00:00 UTC ``` They should only be allowed at 23:59 UTC.
Exposed by: json-schema-org/JSON-Schema-Test-Suite#481 Ruby incorrectly allows `24` as the hour in an RFC3339 timestamp. It also does not handle leap seconds very well: ``` -> Time.parse("23:59:60Z") => 2021-10-18 00:00:00 UTC ``` They should only be allowed at 23:59 UTC.
Based on RFC3339's ABNF, I think this should cover all possibilities:
/c @jnewc