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

Implement ISO weekday number (%u) #36

Merged
merged 2 commits into from
Oct 9, 2017

Conversation

BrianMitchL
Copy link
Contributor

This addresses #31

src/locale.js Outdated
@@ -171,7 +174,8 @@ export default function formatLocale(locale) {

// Convert day-of-week and week-of-year to day-of-year.
if ("W" in d || "U" in d) {
if (!("w" in d)) d.w = "W" in d ? 1 : 0;
if (!("u" in d)) d.u = "W" in d ? 1 : 7;
if (!("w" in d)) d.w = d.u === 7 ? 0 : d.u;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this be a little more concise?

if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, yeah that's much better!

@mbostock mbostock merged commit 8efc194 into d3:master Oct 9, 2017
@mbostock
Copy link
Member

mbostock commented Oct 9, 2017

Thanks! Merged with a few tweaks.

@mbostock mbostock mentioned this pull request Oct 9, 2017
@BrianMitchL BrianMitchL deleted the ISO-weekday-number branch October 3, 2018 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants