-
Notifications
You must be signed in to change notification settings - Fork 45
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 support for ISO week dates #139
Conversation
5bbde9a
to
8f79580
Compare
ef0fae5
to
2b99617
Compare
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.
looks good so far, but please re-request review once tests are passing.
2b99617
to
2f4e08a
Compare
@AlecRosenbaum Sorry about the noise. I realized that I was missing the valid case of |
.. |datetime.fromisoformat| replace:: ``datetime.fromisoformat`` | ||
.. _datetime.fromisoformat: https://docs.python.org/3/library/datetime.html#datetime.datetime.fromisoformat |
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.
This is a reStructured text hack to allow links on inline code blocks.
2f4e08a
to
c565f03
Compare
c565f03
to
751b3bf
Compare
What are you trying to accomplish?
Partly addresses #131.
What approach did you choose and why?
Copied the helper methods from cPython source into a new
isocalendar.c
Added the two new branches, by porting the upstream code
Updated the automatic test generation code:
I also had to exempt
iso_week
from the "too few characters" invalid test generation for cases where it was directly followed byiso_day
. If you reduce theiso_week
field to 1 character, then the followingiso_day
will make it intoYYYYWwD
which gets considered to be a validYYYYWww
timestamp. We don't have this problem with non-week-date timestamps, sinceYYYYMM
is not a valid timestamp format, andday
is always two characters (so the equivalentYYYYMD
cannot happen). Note that this isn't a problem change the parser, but the way the invalid test case generation code was working.What should reviewers focus on?
Performance for non-week-date timestamps is imperceptibly impacted.
The impact of these changes
ciso8601
will now support the same subset of ISO 8601 as Python itself.