Skip to content
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

Merged
merged 4 commits into from
Aug 23, 2020
Merged

ISO 8601 year (%G and %g) #52

merged 4 commits into from
Aug 23, 2020

Conversation

davinov
Copy link
Contributor

@davinov davinov commented Jan 4, 2019

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.

@davinov
Copy link
Contributor Author

davinov commented Jan 4, 2019

Thanks @BrianMitchL for your work on #37 that makes this PR easy.
I just noticed that you started with the same idea on #49 :s

Copy link
Member

@Fil Fil left a 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

@Fil Fil mentioned this pull request Jun 5, 2020
@davinov
Copy link
Contributor Author

davinov commented Jun 8, 2020

Do you want to rebase it? Thank you

It's been a while :D I will do so

@davinov
Copy link
Contributor Author

davinov commented Jun 8, 2020

@Fil Rebased :)

Copy link
Member

@Fil Fil left a 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 :)

@Fil Fil added the feature label Jul 10, 2020
@Fil Fil merged commit 21fe0a1 into d3:master Aug 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

2 participants