-
Notifications
You must be signed in to change notification settings - Fork 121
fix(dateparse): date parse did not support all date types #274
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(dateparse): date parse did not support all date types #274
Conversation
Hi @KrohnusMelavea, thanks for the PR. Would you mind adding a few unit tests please to show different date formats that now work that didn't before. Thanks! |
Added positive and negative tests for my new branch implementing the fixed date parse. How would you like me to create the tests for the existing implementation on your repository? I could branch off main, add similar tests to the current implementation to demonstrate it failing, then create a pull request for that second branch? |
Looks great, thanks!
Feel free to just add those tests to this branch, maybe in a seperate |
The date parser will now try to create a new Date() rather than checking for specific date regex
b1d9c99
to
a2d8291
Compare
Thanks for the tests @KrohnusMelavea! I cleaned the commits up a bit and will now merge and release. |
🎉 This PR is included in version 19.0.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
I hope this doesn't have too much of a performance impact now that we're trying to instantiate a date rather than using regex. If we get performance complaints then I think we might need to go back to a regex but perhaps a regex that supports more dates. There are some very thorough ones here https://stackoverflow.com/questions/15491894/regex-to-validate-date-formats-dd-mm-yyyy-dd-mm-yyyy-dd-mm-yyyy-dd-mmm-yyyy |
Hmm, it didn't cause any problems in our codebase. Let me know if it ends up being an issue, and I'd be more than happy to amend my implementation. |
OK sounds great 👌 Thanks again |
There is a flaw in this logic where numbers are sometimes treated as dates. See #275 |
Decided to revert this change. See #285 for details. |
Previously did not support all date formats, now it does.