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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert date to a known format #216

Merged
merged 2 commits into from
Oct 7, 2019
Merged

Convert date to a known format #216

merged 2 commits into from
Oct 7, 2019

Conversation

j0k3r
Copy link
Owner

@j0k3r j0k3r commented Oct 7, 2019

Instead of just validating the date is ok when parsing it, just convert it to the W3C format

Instead of just validating the date is ok when parsing it, just convert it to the W3C format
Also `DateTimeInterface` is only available since PHP 7.2
@jtojnar
Copy link
Collaborator

jtojnar commented Oct 7, 2019

Why not just make validateDate return ?DateTime?

@j0k3r
Copy link
Owner Author

j0k3r commented Oct 7, 2019

@jtojnar because it'll break compatibility with current date return. Today we return a plain text which is a valid date according to parse_date function. Now it'll return a formatted date instead but it'll still be a string.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.005%) to 96.52% when pulling d1dbce1 on feature/convert-date into 497f073 on master.

@tcitworld
Copy link
Collaborator

tcitworld commented Oct 7, 2019

DateTimeInterface ? Available since PHP 7.2 ? Looks odd.

@j0k3r
Copy link
Owner Author

j0k3r commented Oct 7, 2019

Nope, it's only the constant that are moved to DateTimeInterface in PHP 7.2, before they were defined in DateTime:

7.2.0 | The class constants of DateTime are now defined on DateTimeInterface.

@j0k3r j0k3r merged commit facb144 into master Oct 7, 2019
@j0k3r j0k3r deleted the feature/convert-date branch October 7, 2019 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants