-
Notifications
You must be signed in to change notification settings - Fork 97
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
ISO 8601 year (%G and %g) #52
Conversation
Thanks @BrianMitchL for your work on #37 that makes this PR easy. |
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.
Do you want to rebase it? Thank you
It's been a while :D I will do so |
@Fil Rebased :) |
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.
Testing, I was suprised that there are sometimes 53 weeks!
"2021-01-03 = Sun week 53 2020"
but I cross-checked with http://blog.stevenlevithan.com/archives/date-time-format and with https://www.epochconverter.com/weeknumbers, and it seems to be true :)
Following the example of #37 and the documentation of strftime, I suggest adding the
%G
and%g
specifiers.In time-series with a weekly granularity spanning on more than one year, the format
Week %V %Y
seems appropriate.However, for the end of 2018, it displays the following:
Week 52 2018
,Week 01 2018
.This is because the first day of the first ISO week of 2019 is December 31st 2018, hence is year is
2018
.Instead, we would like to display the year that correspond to the ISO week with
Week %V %G
:Week 52 2018
,Week 01 2019
.The parsing operation doesn't need any work according to tests:
%G
and%g
are just aliases for%Y
and%y
.