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

Intl.Locale.getWeekInfo() fixes #33976

Merged
merged 1 commit into from
Jun 21, 2024
Merged

Intl.Locale.getWeekInfo() fixes #33976

merged 1 commit into from
Jun 21, 2024

Conversation

Josh-Cena
Copy link
Member

@Josh-Cena Josh-Cena requested a review from a team as a code owner June 7, 2024 07:07
@Josh-Cena Josh-Cena requested review from teoli2003 and removed request for a team June 7, 2024 07:07
@github-actions github-actions bot added Content:JS JavaScript docs size/s [PR only] 6-50 LoC changed labels Jun 7, 2024
Copy link
Contributor

github-actions bot commented Jun 7, 2024

Preview URLs

External URLs (1)

URL: /en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/getWeekInfo
Title: Intl.Locale.prototype.getWeekInfo()

@jackdeguest
Copy link
Contributor

Thank you @Josh-Cena Lookds great !

Comment on lines -51 to +52
const msBN = new Intl.Locale("ms-BN");
console.log(msBN.getWeekInfo()); // { firstDay: 7, weekend: [5, 7], minimalDays: 1 }
// Brunei weekend is Friday and Sunday but not Saturday
const arAF = new Intl.Locale("ar-AF"); // Arabic (Afghanistan)
console.log(arAF.getWeekInfo()); // { firstDay: 6, weekend: [4, 5], minimalDays: 1 }

Choose a reason for hiding this comment

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

I'm not sure why you'd omit an example where the weekend is not contiguous. That in combination with the note above seems to encourage people to ignore places where the weekend is split up. If you're going to use this API at all you might as well use it as intended

Copy link

@jamiebuilds jamiebuilds Jun 12, 2024

Choose a reason for hiding this comment

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

I see the other issue now, the underlying CLDR dataset is wrong. I think in this case there should be clarification and an issue filed in the cldr repo as the weekend in Brunei is on Friday and Sunday.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see the other issue now, the underlying CLDR dataset is wrong. I think in this case there should be clarification and an issue filed in the cldr repo as the weekend in Brunei is on Friday and Sunday.

You can report an issue to the Unicode CLDR here: https://cldr.unicode.org/

Choose a reason for hiding this comment

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

Copy link
Member Author

@Josh-Cena Josh-Cena Jun 12, 2024

Choose a reason for hiding this comment

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

Yeah, thanks for the link. Until the bug is fixed (and browsers ship it) we can keep the examples in this form.

Copy link
Collaborator

@wbamberg wbamberg left a comment

Choose a reason for hiding this comment

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

👍

@wbamberg wbamberg merged commit adac5ac into mdn:main Jun 21, 2024
7 checks passed
@Josh-Cena Josh-Cena deleted the fix-week-info branch June 21, 2024 21:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Content:JS JavaScript docs size/s [PR only] 6-50 LoC changed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Part of the example provided is factually incorrect minimalDays could use more explanation
4 participants