Skip to content

The example of Temporal.PlainDate should be revised #42565

@ksh8281

Description

@ksh8281

MDN URL

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/PlainDate/from

What specific section or headline is this issue about?

Examples - Creating a PlainDate from an object

What information was incorrect, unhelpful, or incomplete?

The chinese calendar spec is changed
https://tc39.es/proposal-intl-era-monthcode/#table-epoch-years

// Year, month, day in a different calendar
const d3 = Temporal.PlainDate.from({
  year: 2021,
  month: 7,
  day: 1,
  calendar: "chinese",
});
// Note: when you construct a date with an object, the date components
// are in *that* calendar, not the ISO calendar. However, toString() always
// outputs the date in the ISO calendar. For example, the year "2021" in
// the Chinese calendar is actually 616 BC in the ISO calendar.
console.log(d3.toString()); // "-000616-08-12[u-ca=chinese]"

above example shows different toString result 2021-08-08[u-ca=chinese]

What did you expect to see?

MDN can provide better example via choose other calendar like 'hebrew'

Do you have any supporting links, references, or citations?

https://tc39.es/proposal-intl-era-monthcode/#table-epoch-years

Do you have anything more you want to share?

No response

MDN metadata

Page report details

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions