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

Update Intl.DateTimeFormat calendars to match supported list #12764

Merged
merged 1 commit into from
Feb 6, 2022

Conversation

justingrant
Copy link
Contributor

@justingrant justingrant commented Feb 6, 2022

Summary

This PR corrects the list of supported calendars to match the actual supported calendar list, which is here:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/calendar

Not sure why DateTimeFormat's docs have an incorrect list, but the list in the Locale docs (linked above) is correct.

Note that in addition to being incomplete, the current content also has a typo: there's no ethiopia calendar. The correct name is ethioaa, with two a's and no p. This PR fixes this typo too.

Motivation

The current list of calendars is inaccurate and inconsistent with other MDN docs.

Supporting details

Here's a repro showing that the list of calendars in this PR is actually supported in the latest versions of Firefox, Chrome, and Safari:

calendars = [
  "buddhist", 
  "chinese", 
  "coptic", 
  "dangi", 
  "ethioaa", 
  "ethiopic", 
  "gregory", 
  "hebrew", 
  "indian", 
  "islamic", 
  "islamic-umalqura", 
  "islamic-tbla", 
  "islamic-civil", 
  "islamic-rgsa", 
  "iso8601", 
  "japanese", 
  "persian", 
  "roc", 
  "islamicc"
];
// using `calendar` option
calendars.forEach(calendar => console.log(`${calendar} option: ${new Intl.DateTimeFormat('en-US', { calendar }).format(new Date())}`));
// using calendar inside locale
calendars.forEach(calendar => console.log(`${calendar} in locale: ${new Intl.DateTimeFormat(`en-US-u-ca-${calendar}`).format(new Date())}`));

Related issues

mdn/translated-content#4012 (similar typo in French localized docs for Date.prototype.toLocaleString / Date.prototype.toLocaleDateString)

Metadata

  • Adds a new document
  • Rewrites (or significantly expands) a document
  • Fixes a typo, bug, or other error

This commit updates the list of supported calendars to match the actual supported list from here:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/Locale/calendar
Copy link
Member

@teoli2003 teoli2003 left a comment

Choose a reason for hiding this comment

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

Good catch!

@teoli2003 teoli2003 merged commit 870522f into mdn:main Feb 6, 2022
@teoli2003
Copy link
Member

Thanks a lot!

Looks good to me.

Congratulations upon your first merged commit here! Welcome aboard! 🎉

@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2022

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Content:JS JavaScript docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants