Skip to content

accept ISO-8601 dates, and rework dateTime2ms #1158

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

Closed
wants to merge 2 commits into from

Conversation

alexcjohnson
Copy link
Collaborator

fixes #1003

For simplicity, I ended up separately allowing the date/time separator to be space, t, or T, and a timezone spec at the end - ie timezones are now accepted for our normal space-separated format too.

Also @etpinard a perf note - I switched from the manual string chopping we had before to a regexp-based conversion. When I originally wrote this converter a few years ago it was clearly faster to do it manually, but now either because our patterns have gotten more complicated, or browsers have improved their regexp engines, it's faster this way. It's also a lot shorter code-wise (though I wouldn't exactly call it nicer to look at, with that mile-long regexp!)

On Chrome, the old way (extended to ISO-8601) was taking ~2microsec per conversion, the new way is ~1.3microsec. FF is quite a bit slower at both versions, but the regexp is faster there too: ~6.8microsec vs ~10.7microsec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support ISO 8601 timestamps
2 participants