-
Notifications
You must be signed in to change notification settings - Fork 22.5k
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
Missing text and the same code output #37609
Comments
Good spot of the typo. However, |
Hi @antracer , @Josh-Cena I can fix this issue, but I need clarification on the exact desired output. Here’s what I suggest for the desired result:
To achieve this, you’ll need to adjust the opts options as follows:
This configuration sets the month to "long", which ensures that the month name is correctly returned in the desired format (e.g., "十一月" for November). You may want to update the documentation to reflect this change, as the current statement:
is not accurate in this context. This statement needs correction because it doesn't account for the fact that setting the month and day alongside the year can result in different formatting outcomes, as shown in the example. Also, if you want to follow the approach that @Josh-Cena specified, the correct opt settings would be:
With this, the output would look like this:
Let me know if this matches your expectations, and what you desire then I’ll proceed with the final fixes accordingly. |
MDN URL
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts
What specific section or headline is this issue about?
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts#named_years_and_mixed_calendars
What information was incorrect, unhelpful, or incomplete?
"Setting an entry in the bag for
year
(with any value) will yield both the and theyearName
GregorianrelatedYear
:"Also the same output of 2 code blocks below the text:
What did you expect to see?
Maybe "Setting an entry in the bag for
year
(with any value) will yield both theyearName
and the GregorianrelatedYear
:"Then, for the first code block:
// return value [ + { type: "yearName", value: "zh-u-ca-chinese" }, { type: "relatedYear", value: "2012" }, { type: "literal", value: "年" }, { type: "month", value: "十一月" }, { type: "day", value: "4" }, ];
Do you have any supporting links, references, or citations?
No response
Do you have anything more you want to share?
No response
MDN metadata
Page report details
en-us/web/javascript/reference/global_objects/intl/datetimeformat/formattoparts
The text was updated successfully, but these errors were encountered: