-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
Support basic datetime format in Calendar.ISO parsing functions #10693
Support basic datetime format in Calendar.ISO parsing functions #10693
Conversation
ac4fd93
to
e69e35e
Compare
e69e35e
to
d494d71
Compare
Hi @christhekeele, can we please go only with the |
24372d6
to
3ecd7df
Compare
3ecd7df
to
712b2cb
Compare
@josevalim |
Should I add something to the changelog about this within this PR, or is that handled during release? |
Thanks for asking, changelogs are handled later on, to avoid conflicts! |
I'm not sure if this was already mentioned, but this is a nice way of solving [Proposal] Add ability to parse ISO8601 "basic" format. In that thread, it wasn't clear how the API would look like, ideally it would be option 1 & 2 which are ambiguous.
Well, it's |
@wojtekmach don't celebrate too much because next step is to figure out a why to surface that upstream. :D But I think we can look at the second argument and decide accordingly. So it will be:
|
Yeah, the I've always been a little confused about the use case of the signature of So |
As a side topic would RFC1123 datetime format ( |
@AndrewDryga I think it's worth bringing up on the core mailing list--this PR is mostly for parsing/formatting parity--but my suspicion is that that's better suited for an external library. My way of thinking about this is that the core |
""" | ||
@doc since: "1.12.0" | ||
def parse_date("-" <> string, format) when is_binary(string), | ||
do: do_parse_date(string, -1, 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.
Negative dates are only allowed in the extended format, so we should handle the +/- within :extended. :)
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.
Good point!
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.
I just revised the spec on this--there are two extended formats in play.
One is the general "extended" (as opposed to "basic") format--ie with separators or not. That's what the :basic
and :extended
flags here entail.
The other we have decided to support, to work with a wider range of dates, is the "year extension". But our support for that is independent of basic vs extended separator format, and should work with both.
TL;DR I believe this is correct as writ
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.
You are correct. I confused expanded with extended. :)
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.
It looks great! I have added only two comments but they will also apply for naive dt stuff too!
💚 💙 💜 💛 ❤️ |
This PR adds support for an optional second parameter to
Calendar.ISO
parsing functions, allowing them to parse the:basic
format as well as the (default):extended
.