-
Notifications
You must be signed in to change notification settings - Fork 96
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
Fix date-time type format #20
Conversation
Awesome! Can you please add a test for this? |
@lezhnev74 / @sunspikes - I've actually just written a test for the PR I was working on - is there a way I can contribute it to your branch? |
@lezhnev74 Done! |
@coatesap sorry, i missed your comment. May be you can add those extra tests in a new PR ? |
Unfortunately |
Nice work @sunspikes 👍. I've pushed my branch up as a PR #21, but I think your approach of unit testing the StringDateTime class directly is better. Also, it's good if it supports microseconds as well, as other users might need that. |
@sunspikes - out of interest - does the format |
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.
LGTM, but some minor changes needed.
Do we have any kind of functional test that validator works correctly with new string formats?.
Looking at https://3v4l.org/jSDKd it does seem to work fine, which would both avoid the need for a new class and also supports microseconds out of the box. |
Afaics, with milliseconds it fails for PHP 7.2 https://travis-ci.org/thephpleague/openapi-psr7-validator/jobs/596524264 |
@sunspikes - Feel free to take the functional test from #21 if you want |
Wasn't that using |
Yes it is but it fails with @coatesap Thank you, i've added your tests cases too |
I've added the functional tests from the other PR, courtesy of @coatesap |
Yes, but my suggestion was just to use |
@coatesap Sorry i missed that point. Yes we could do that. But in this case we need to consider one more scenario from https://tools.ietf.org/html/rfc3339#section-5.6
But this can also be included with an extra check. |
Can you try this? I hope this would be much easier to read later |
@scaytrase done!, yes, i think it's better than maintaining one more class for this. |
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.
LGTM 👍
Nice, that's a really clean implementation 👍 |
Thanks @sunspikes and @coatesap |
Fixes #19
The the RFC3339
date-time
can be with or without milliseconds and with or without specific timezone offsets.With PHP milliseconds support was added in
DateTimeInterface::RFC3339_EXTENDED
(https://www.php.net/manual/en/class.datetimeinterface.php#datetime.constants.rfc3339_extended) but this doesn't support the other format without milliseconds. So we need to check both.https://3v4l.org/r059V