-
Notifications
You must be signed in to change notification settings - Fork 15
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
Add a function for parsing ISO-8601 date time strings #15
base: master
Are you sure you want to change the base?
Conversation
I think it would be better if |
It's generally hard to detect the time format for parsing, so I think it's better to be specify an explicit format. |
That's sort of my point :-) It's hard, so it would be better for the library to be responsible for it rather than requiring clients to have to do the detection. I guess I'm just puzzled why |
If a time string is obviously not ISO-8601, the user would want to skip extra computation of trying to parse it. Thus the user should know what date format is used. Otherwise, the smart parsing function should be named like |
OK, I can see there's some value in that. It would then come down to deciding which case gets the default behavior (and short, simple name), and which case gets the more specific name. My preference would be to have |
Performance is a goal of this project, because some of its functions may be used in tight loops (e.g. in code that parses many timestamps in Org files), so the Even Emacs treats ISO-8601 as an explicitly known format that should be parsed intentionally, so I think it makes sense for us to do so as well. If there's really a need for a flexible, "smart" parsing function that can handle both ISO-8601 and other formats supported by Emacs, then we could have such a function separately. But the user should make a conscious decision to use that function when necessary, so as not to penalize all other uses with the reduced performance. |
This is currently a draft.
The test fails in my time zone, so I'll rework on this after #8 is merged. I want to follow styles of other test cases.
Perhaps I'll have to implement
ts-parse-iso8601-fill
as well.