-
-
Notifications
You must be signed in to change notification settings - Fork 216
Normalize optional/format/date-time, improve leap seconds tests. #517
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
Normalize optional/format/date-time, improve leap seconds tests. #517
Conversation
please request reviews of the team, not just me. I am just one cat! |
@karenetheridge I also requested the team review above ). |
this looks good to me -- it just needs a rebase with master as there are some conflicts there. thanks! |
actually -- can you add an invalid leap second test too? say "1998-12-30T23:59:60Z" (one day before the real leap second), to check that implementations don't just accept |
e31f2b2
to
63f8e93
Compare
@karenetheridge Rebased. Re: tests for invalid leap seconds — see the PR description, I'm not convinced yet that it's a good idea to add those. The referenced spec doesn't maintain a list of leap seconds and instead points to an external resource for that in an appendix.
I think given that the spec is more complex on that, we can handle that in a separate PR if desired. |
@karenetheridge I added a test that verifies that
|
Right, no date/time parser should ever be assuming what leap seconds are going to exist in the future, since indeed the rules for determining when they exist are not predictable and depends on astronomical observations. :) So this comes down to "how picky do we really want to be", which has been the case for so many other formats :). Some implementations may find it easy to verify whether a particular timestamp in the past is indeed a valid leap second or not (by using a lookup table that is available to it), and others may not. We do consider dates like "2001-02-31" to be invalid, even though it is syntactically correct, because we know that the month of February can never have 31 days. There's also a rule that leap seconds can only be added to the last second of a day (therefore 23:59:60 might be a valid leap second, but 22:58:60 can never be valid). It's just "which days" that's the tricky part. tldr: IMO, If there's doubt, best to leave it out (i.e. not have a valid or invalid test for that case). |
Yeah, let's at least keep that out of this PR. :-)
Ah, that's a good one. Added it (and for the wrong hour). Does this LGTY? |
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.
yes, this LGTM!
an invalid closing Z after time-zone offset
testcase from draft6 to draft2019-09, draft2020-12, draft7, draft4, draft-future where it was missing.optional/format/time
).a invalid day in date-time string
andan invalid offset in date-time string
tests to ensure that they fail because of those reasons and not because of a leap second.Note that while this uses a valid leap second date (
1998-12-31
, which is stated explicitly in RFC 3339, Appendix D) this doesn't test that the validator actually has a list of valid leap seconds and not just verifies the shape per RFC 3339. I.e. there is no test that should fail because of invalid date/leap second combo, as leap seconds come from an external data source and might be introduced later. Even checking that they are in****-12-31
or****-06-31
is invalid, as that might be changed in the data source and is not a hard requirement.Refs: