diff --git a/files/en-us/web/javascript/reference/global_objects/temporal/plaindate/era/index.md b/files/en-us/web/javascript/reference/global_objects/temporal/plaindate/era/index.md index 759996641fdfa91..3b1af913a6edbb8 100644 --- a/files/en-us/web/javascript/reference/global_objects/temporal/plaindate/era/index.md +++ b/files/en-us/web/javascript/reference/global_objects/temporal/plaindate/era/index.md @@ -7,9 +7,9 @@ browser-compat: javascript.builtins.Temporal.PlainDate.era sidebar: jsref --- -The **`era`** accessor property of {{jsxref("Temporal.PlainDate")}} instances returns a calendar-specific lowercase string representing the era of this date, or `undefined` if the calendar does not use eras (e.g., ISO 8601). `era` and `eraYear` together uniquely identify a year in a calendar, in the same way that `year` does. It is [calendar](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendars)-dependent. For Gregorian, it is either `"gregory"` or `"gregory-inverse"`. +The **`era`** accessor property of {{jsxref("Temporal.PlainDate")}} instances returns a calendar-specific lowercase string representing the era of this date, or `undefined` if the calendar does not use eras (e.g., ISO 8601). `era` and `eraYear` together uniquely identify a year in a calendar, in the same way that `year` does. It is [calendar](//en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendarsen-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendars)-dependent. For Gregorian, it is either `"ce"` or `"bce"`. -The set accessor of `era` is `undefined`. You cannot change this property directly. Use the {{jsxref("Temporal/PlainDate/with", "with()")}} method to create a new `Temporal.PlainDate` object with the desired new value. When setting eras, each code may have some aliases; for example, `"ce"` and `"ad"` are equivalent to `"gregory"`, and `"bce"` and `"bc"` are equivalent to `"gregory-inverse"`. +The set accessor of `era` is `undefined`. You cannot change this property directly. Use the {{jsxref("Temporal/PlainDate/with", "with()")}} method to create a new `Temporal.PlainDate` object with the desired new value. When setting eras, each code may have some aliases; for example, `"ad"` is equivalent to `"ce"`, and `"bc"` is equivalent to `"bce"`. > [!NOTE] > This string is not intended for display to users. Use {{jsxref("Temporal/PlainDate/toLocaleString", "toLocaleString()")}} with the appropriate options to get a localized string. @@ -23,10 +23,10 @@ const date = Temporal.PlainDate.from("2021-07-01"); // ISO 8601 calendar console.log(date.era); // undefined const date2 = Temporal.PlainDate.from("2021-07-01[u-ca=gregory]"); -console.log(date2.era); // gregory +console.log(date2.era); // ce const date3 = Temporal.PlainDate.from("-002021-07-01[u-ca=gregory]"); -console.log(date3.era); // gregory-inverse +console.log(date3.era); // bce const date4 = Temporal.PlainDate.from("2021-07-01[u-ca=japanese]"); console.log(date4.era); // reiwa diff --git a/files/en-us/web/javascript/reference/global_objects/temporal/plaindate/index.md b/files/en-us/web/javascript/reference/global_objects/temporal/plaindate/index.md index 2ae8caaf704cfd1..c91f22e9fbfa15e 100644 --- a/files/en-us/web/javascript/reference/global_objects/temporal/plaindate/index.md +++ b/files/en-us/web/javascript/reference/global_objects/temporal/plaindate/index.md @@ -75,7 +75,7 @@ These properties are defined on `Temporal.PlainDate.prototype` and shared by all - {{jsxref("Temporal/PlainDate/daysInYear", "Temporal.PlainDate.prototype.daysInYear")}} - : Returns a positive integer representing the number of days in the year of this date. [Calendar](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendars)-dependent. For the ISO 8601 calendar, this is 365, or 366 in a leap year. - {{jsxref("Temporal/PlainDate/era", "Temporal.PlainDate.prototype.era")}} - - : Returns a calendar-specific lowercase string representing the era of this date, or `undefined` if the calendar does not use eras (e.g., ISO 8601). `era` and `eraYear` together uniquely identify a year in a calendar, in the same way that `year` does. [Calendar](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendars)-dependent. For Gregorian, it is either `"gregory"` or `"gregory-inverse"`. + - : Returns a calendar-specific lowercase string representing the era of this date, or `undefined` if the calendar does not use eras (e.g., ISO 8601). `era` and `eraYear` together uniquely identify a year in a calendar, in the same way that `year` does. [Calendar](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendars)-dependent. For Gregorian, it is either `"ce"` or `"bce"`. - {{jsxref("Temporal/PlainDate/eraYear", "Temporal.PlainDate.prototype.eraYear")}} - : Returns a non-negative integer representing the year of this date within the era, or `undefined` if the calendar does not use eras (e.g., ISO 8601). The year index usually starts from 1 (more common) or 0, and years in an era can decrease with time (e.g., Gregorian BCE). `era` and `eraYear` together uniquely identify a year in a calendar, in the same way that `year` does. [Calendar](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendars)-dependent. - {{jsxref("Temporal/PlainDate/inLeapYear", "Temporal.PlainDate.prototype.inLeapYear")}} diff --git a/files/en-us/web/javascript/reference/global_objects/temporal/plaindatetime/era/index.md b/files/en-us/web/javascript/reference/global_objects/temporal/plaindatetime/era/index.md index 8598a93ad83b38c..728049303478ed2 100644 --- a/files/en-us/web/javascript/reference/global_objects/temporal/plaindatetime/era/index.md +++ b/files/en-us/web/javascript/reference/global_objects/temporal/plaindatetime/era/index.md @@ -22,7 +22,7 @@ const dt = Temporal.PlainDateTime.from("2021-07-01"); // ISO 8601 calendar console.log(dt.era); // undefined const dt2 = Temporal.PlainDateTime.from("2021-07-01[u-ca=gregory]"); -console.log(dt2.era); // gregory +console.log(dt2.era); // ce ``` ## Specifications diff --git a/files/en-us/web/javascript/reference/global_objects/temporal/plaindatetime/index.md b/files/en-us/web/javascript/reference/global_objects/temporal/plaindatetime/index.md index 4f3528214b1a4fe..17a5bfba290577d 100644 --- a/files/en-us/web/javascript/reference/global_objects/temporal/plaindatetime/index.md +++ b/files/en-us/web/javascript/reference/global_objects/temporal/plaindatetime/index.md @@ -76,7 +76,7 @@ These properties are defined on `Temporal.PlainDateTime.prototype` and shared by - {{jsxref("Temporal/PlainDateTime/daysInYear", "Temporal.PlainDateTime.prototype.daysInYear")}} - : Returns a positive integer representing the number of days in the year of this date. [Calendar](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendars)-dependent. For the ISO 8601 calendar, this is 365, or 366 in a leap year. - {{jsxref("Temporal/PlainDateTime/era", "Temporal.PlainDateTime.prototype.era")}} - - : Returns a calendar-specific lowercase string representing the era of this date, or `undefined` if the calendar does not use eras (e.g., ISO 8601). `era` and `eraYear` together uniquely identify a year in a calendar, in the same way that `year` does. [Calendar](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendars)-dependent. For Gregorian, it is either `"gregory"` or `"gregory-inverse"`. + - : Returns a calendar-specific lowercase string representing the era of this date, or `undefined` if the calendar does not use eras (e.g., ISO 8601). `era` and `eraYear` together uniquely identify a year in a calendar, in the same way that `year` does. [Calendar](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendars)-dependent. For Gregorian, it is either `"ce"` or `"bce"`. - {{jsxref("Temporal/PlainDateTime/eraYear", "Temporal.PlainDateTime.prototype.eraYear")}} - : Returns a non-negative integer representing the year of this date within the era, or `undefined` if the calendar does not use eras (e.g., ISO 8601). The year index usually starts from 1 (more common) or 0, and years in an era can decrease with time (e.g., Gregorian BCE). `era` and `eraYear` together uniquely identify a year in a calendar, in the same way that `year` does. [Calendar](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendars)-dependent. - {{jsxref("Temporal/PlainDateTime/hour", "Temporal.PlainDateTime.prototype.hour")}} diff --git a/files/en-us/web/javascript/reference/global_objects/temporal/plainyearmonth/era/index.md b/files/en-us/web/javascript/reference/global_objects/temporal/plainyearmonth/era/index.md index 2255ab7c5ad7c3a..87fdf673f3fef23 100644 --- a/files/en-us/web/javascript/reference/global_objects/temporal/plainyearmonth/era/index.md +++ b/files/en-us/web/javascript/reference/global_objects/temporal/plainyearmonth/era/index.md @@ -22,7 +22,7 @@ const ym = Temporal.PlainYearMonth.from("2021-07"); // ISO 8601 calendar console.log(ym.era); // undefined const ym2 = Temporal.PlainYearMonth.from("2021-07-01[u-ca=gregory]"); -console.log(ym2.era); // gregory +console.log(ym2.era); // ce ``` ## Specifications diff --git a/files/en-us/web/javascript/reference/global_objects/temporal/plainyearmonth/index.md b/files/en-us/web/javascript/reference/global_objects/temporal/plainyearmonth/index.md index 63a30d878125290..2cb92c23de11d77 100644 --- a/files/en-us/web/javascript/reference/global_objects/temporal/plainyearmonth/index.md +++ b/files/en-us/web/javascript/reference/global_objects/temporal/plainyearmonth/index.md @@ -58,7 +58,7 @@ These properties are defined on `Temporal.PlainYearMonth.prototype` and shared b - {{jsxref("Temporal/PlainYearMonth/daysInYear", "Temporal.PlainYearMonth.prototype.daysInYear")}} - : Returns a positive integer representing the number of days in the year of this date. [Calendar](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendars)-dependent. For the ISO 8601 calendar, this is 365, or 366 in a leap year. - {{jsxref("Temporal/PlainYearMonth/era", "Temporal.PlainYearMonth.prototype.era")}} - - : Returns a calendar-specific lowercase string representing the era of this year-month, or `undefined` if the calendar does not use eras (e.g., ISO 8601). `era` and `eraYear` together uniquely identify a year in a calendar, in the same way that `year` does. [Calendar](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendars)-dependent. For Gregorian, it is either `"gregory"` or `"gregory-inverse"`. + - : Returns a calendar-specific lowercase string representing the era of this year-month, or `undefined` if the calendar does not use eras (e.g., ISO 8601). `era` and `eraYear` together uniquely identify a year in a calendar, in the same way that `year` does. [Calendar](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendars)-dependent. For Gregorian, it is either `"ce"` or `"bce"`. - {{jsxref("Temporal/PlainYearMonth/eraYear", "Temporal.PlainYearMonth.prototype.eraYear")}} - : Returns a non-negative integer representing the year of this year-month within the era, or `undefined` if the calendar does not use eras (e.g., ISO 8601). The year index usually starts from 1 (more common) or 0, and years in an era can decrease with time (e.g., Gregorian BCE). `era` and `eraYear` together uniquely identify a year in a calendar, in the same way that `year` does. [Calendar](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendars)-dependent. - {{jsxref("Temporal/PlainYearMonth/inLeapYear", "Temporal.PlainYearMonth.prototype.inLeapYear")}} diff --git a/files/en-us/web/javascript/reference/global_objects/temporal/zoneddatetime/era/index.md b/files/en-us/web/javascript/reference/global_objects/temporal/zoneddatetime/era/index.md index 796981d38b73a45..2e7c30eac57dbe5 100644 --- a/files/en-us/web/javascript/reference/global_objects/temporal/zoneddatetime/era/index.md +++ b/files/en-us/web/javascript/reference/global_objects/temporal/zoneddatetime/era/index.md @@ -18,13 +18,13 @@ For general information and more examples, see {{jsxref("Temporal/PlainDate/era" ### Using era ```js -const dt = Temporal.ZonedDateTime.from("2021-07-01[America/New_York]"); // ISO 8601 calendar -console.log(dt.era); // undefined +const zdt = Temporal.ZonedDateTime.from("2021-07-01[America/New_York]"); // ISO 8601 calendar +console.log(zdt.era); // undefined -const dt2 = Temporal.ZonedDateTime.from( +const zdt2 = Temporal.ZonedDateTime.from( "2021-07-01[America/New_York][u-ca=gregory]", ); -console.log(dt2.era); // gregory +console.log(zdt2.era); // ce ``` ## Specifications diff --git a/files/en-us/web/javascript/reference/global_objects/temporal/zoneddatetime/index.md b/files/en-us/web/javascript/reference/global_objects/temporal/zoneddatetime/index.md index ffefd655b0e8b42..89aa40bf92d4153 100644 --- a/files/en-us/web/javascript/reference/global_objects/temporal/zoneddatetime/index.md +++ b/files/en-us/web/javascript/reference/global_objects/temporal/zoneddatetime/index.md @@ -207,7 +207,7 @@ These properties are defined on `Temporal.ZonedDateTime.prototype` and shared by - {{jsxref("Temporal/ZonedDateTime/epochNanoseconds", "Temporal.ZonedDateTime.prototype.epochNanoseconds")}} - : Returns a {{jsxref("BigInt")}} representing the number of nanoseconds elapsed since the Unix epoch (midnight at the beginning of January 1, 1970, UTC) to this instant. - {{jsxref("Temporal/ZonedDateTime/era", "Temporal.ZonedDateTime.prototype.era")}} - - : Returns a calendar-specific lowercase string representing the era of this date, or `undefined` if the calendar does not use eras (e.g., ISO 8601). `era` and `eraYear` together uniquely identify a year in a calendar, in the same way that `year` does. [Calendar](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendars)-dependent. For Gregorian, it is either `"gregory"` or `"gregory-inverse"`. + - : Returns a calendar-specific lowercase string representing the era of this date, or `undefined` if the calendar does not use eras (e.g., ISO 8601). `era` and `eraYear` together uniquely identify a year in a calendar, in the same way that `year` does. [Calendar](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendars)-dependent. For Gregorian, it is either `"ce"` or `"bce"`. - {{jsxref("Temporal/ZonedDateTime/eraYear", "Temporal.ZonedDateTime.prototype.eraYear")}} - : Returns a non-negative integer representing the year of this date within the era, or `undefined` if the calendar does not use eras (e.g., ISO 8601). The year index usually starts from 1 (more common) or 0, and years in an era can decrease with time (e.g., Gregorian BCE). `era` and `eraYear` together uniquely identify a year in a calendar, in the same way that `year` does. [Calendar](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal#calendars)-dependent. - {{jsxref("Temporal/ZonedDateTime/hour", "Temporal.ZonedDateTime.prototype.hour")}}