You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adjust docs for Temporal.Calendar for a few reasons:
* Account for #2574 which stops coercing non-string inputs
* Fix inaccurate claims in the constructor docs
* Reorganize sample code for `from` for clarity
Copy file name to clipboardExpand all lines: docs/calendar.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -175,7 +175,7 @@ For a list of calendar identifiers, see the documentation for [Intl.DateTimeForm
175
175
If `calendarIdentifier` is not a built-in calendar, then a `RangeError` is thrown.
176
176
177
177
Use this constructor directly if you have a string that is known to be a correct built-in calendar identifier.
178
-
If you have an ISO 8601 date-time string with a `[u-ca=identifier]` annotation, then `Temporal.Calendar.from()` is more convenient than parsing the identifier out of the string, and also the only way to parse strings annotated with a non-built-in calendar.
178
+
If you have an ISO 8601 date-time string with a `[u-ca=identifier]` annotation, then `Temporal.Calendar.from()` is more convenient than parsing the identifier out of the string.
179
179
180
180
Example usage:
181
181
@@ -199,9 +199,9 @@ This static method creates a new calendar from another value.
199
199
If the value is another `Temporal.Calendar` object, or object implementing the calendar protocol, the same object is returned.
200
200
If the value is another Temporal object that carries a calendar or an object with a `calendar` property, such as a `Temporal.ZonedDateTime`, the object's calendar is returned.
201
201
202
-
Any other value is converted to a string, which is expected to be either:
202
+
Any other value is required to be a string that is either:
203
203
204
-
- a string that is accepted by `new Temporal.Calendar()`; or
204
+
- a calendar idenfier accepted by `new Temporal.Calendar()`; or
205
205
- a string in the ISO 8601 format.
206
206
207
207
Note that the ISO 8601 string can be extended with a `[u-ca=identifier]` annotation in square brackets appended to it.
@@ -219,13 +219,13 @@ cal = Temporal.Calendar.from('gregory');
219
219
// ISO 8601 string with or without calendar annotation
220
220
cal =Temporal.Calendar.from('2020-01-13T16:31:00.065858086');
221
221
cal =Temporal.Calendar.from('2020-01-13T16:31:00.065858086-08:00[America/Vancouver][u-ca=iso8601]');
222
+
/* WRONG */ cal =Temporal.Calendar.from('[u-ca-iso8601]'); // => throws, lone annotation not a valid ISO 8601 string
222
223
223
224
// Existing calendar object
224
225
cal2 =Temporal.Calendar.from(cal);
225
226
226
-
// Custom calendar that is a plain object (this calendar does not do much)
227
+
// Custom calendar names cannot be parsed from strings
227
228
/* WRONG */ cal =Temporal.Calendar.from('discordian'); // => throws, not a built-in calendar
228
-
/* WRONG */ cal =Temporal.Calendar.from('[u-ca-iso8601]'); // => throws, lone annotation not a valid ISO 8601 string
0 commit comments