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
This is a very large change, as it not only removes Temporal.Calendar and
Temporal.TimeZone, but also tries to eliminate any extra complexity due to
no longer having to deal with user code calls for calendar and time zone
calculations.
Some of the things that are removed or simplified include:
- No more Calendar Method Records and Time Zone Method Records
- In many places, no need to pass around the user's original options bag
- In many places, no need to pass around the user's original PlainDate or
Instant; use epoch nanoseconds, ISO Date Records, and ISO Date-Time
Records instead
- No more copying the own properties of options bags
- Most of the calendar and time zone operations are now infallible
- The set of extra calendar fields that used to be returned by
Temporal.Calendar.prototype.fields() is now static; so no need to have
the complicated PrepareTemporalFields operation that returns a null-
prototype object with own data properties that correspond to arbitrary
user fields. Dates in calendar space can be represented by a Calendar
Fields Record with known fields.
- Much of the special-casing to avoid user calls that was added in #2519
and similar PRs is now unobservable and is removed.
Closes: #2836Closes: #2853Closes: #2854
Copy file name to clipboardExpand all lines: docs/README.md
+14-31Lines changed: 14 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ See [Temporal.Now Documentation](./now.md) for detailed documentation.
53
53
### **Temporal.Instant**
54
54
55
55
A `Temporal.Instant` represents a fixed point in time (called **"exact time"**), without regard to calendar or location, e.g. July 20, 1969, at 20:17 UTC.
56
-
For a human-readable local calendar date or clock time, use a `Temporal.TimeZone`and `Temporal.Calendar` to obtain a `Temporal.ZonedDateTime` or `Temporal.PlainDateTime`.
56
+
For a human-readable local calendar date or clock time, use a time zone and calendar identifier to obtain a `Temporal.ZonedDateTime` or `Temporal.PlainDateTime`.
As the broadest `Temporal` type, `Temporal.ZonedDateTime` can be considered a combination of `Temporal.TimeZone`, `Temporal.Instant`, and `Temporal.PlainDateTime`(which includes `Temporal.Calendar`).
86
+
As the broadest `Temporal` type, `Temporal.ZonedDateTime` can be considered a combination of `Temporal.Instant` and `Temporal.PlainDateTime`with a time zone identifier.
87
87
88
88
See [Temporal.ZonedDateTime Documentation](./zoneddatetime.md) for detailed documentation.
89
89
@@ -126,7 +126,7 @@ See [Temporal.PlainTime Documentation](./plaintime.md) for detailed documentatio
126
126
127
127
A `Temporal.PlainDateTime` represents a calendar date and wall-clock time that does not carry time zone information, e.g. December 7th, 1995 at 3:00 PM (in the Gregorian calendar).
128
128
129
-
It can be converted to a `Temporal.ZonedDateTime` using a `Temporal.TimeZone`.
129
+
It can be converted to a `Temporal.ZonedDateTime` using time zone identifier.
130
130
For use cases that require a time zone, especially using arithmetic or other derived values, consider using `Temporal.ZonedDateTime` instead because that type automatically adjusts for Daylight Saving Time.
131
131
132
132
```js
@@ -192,43 +192,26 @@ Unlike the other Temporal types, the units in `Temporal.Duration` don't naturall
192
192
193
193
See [Duration balancing](./balancing.md) for more on this topic.
194
194
195
-
### **Temporal.TimeZone**
195
+
### Time Zones
196
196
197
-
A `Temporal.TimeZone` represents an IANA time zone, a specific UTC offset, or UTC itself.
198
-
Time zones translate from a date/time in UTC to a local date/time.
199
-
Because of this `Temporal.TimeZone` can be used to convert between `Temporal.Instant` and `Temporal.PlainDateTime` as well as finding out the offset at a specific `Temporal.Instant`.
197
+
A time zone in ECMAScript is usually represented by an IANA Time Zone Database identifier such as `'America/Los_Angeles'`, `'Asia/Tokyo'`, or `'UTC'`.
198
+
Fixed-offset time zone identifiers like `'+05:30'` may also be used, although this usage is discouraged because offsets for a particular location may change in response to political changes.
200
199
201
-
It is also possible to implement your own time zones.
200
+
Time zones translate between a date/time in UTC to a local calendar date and wall clock time.
201
+
`Temporal.ZonedDateTime` provides built-in support for time-zone-aware applications.
202
+
A time zone is required to convert from `Temporal.Instant` or `Temporal.PlainDateTime` to `Temporal.ZonedDateTime`.
Copy file name to clipboardExpand all lines: docs/ambiguity.md
+5-7Lines changed: 5 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -54,10 +54,9 @@ In Temporal:
54
54
55
55
- The [`Temporal.Instant`](./instant.md) type represents exact time only.
56
56
- The [`Temporal.PlainDateTime`](./plaindatetime.md) type represents calendar date and wall-clock time, as do other narrower types: [`Temporal.PlainDate`](./plaindate.md), [`Temporal.PlainTime`](./plaintime.md), [`Temporal.PlainYearMonth`](./plainyearmonth.md), and [`Temporal.PlainMonthDay`](./plainmonthday.md).
57
-
These types all carry a calendar system, which by default is `'iso8601'` (the ISO 8601 calendar) but can be overridden for other [calendars](./calendar.md) like `'islamic'` or `'japanese'`.
58
-
- The [`Temporal.TimeZone`](./timezone.md) represents a time zone function that converts between exact time and wall-clock time and vice-versa.
59
-
It also includes helper functions, e.g. to fetch the current time zone offset for a particular exact time.
60
-
- The [`Temporal.ZonedDateTime`](./zoneddatetime.md) type encapsulates all of the types above: an exact time (like a [`Temporal.Instant`](./instant.md)), its wall-clock equivalent (like a [`Temporal.PlainDateTime`](./plaindatetime.md)), and the time zone that links the two (like a [`Temporal.TimeZone`](./timezone.md)).
57
+
These types all carry a calendar system, which by default is `'iso8601'` (the ISO 8601 calendar) but can be overridden for other calendars like `'islamic'` or `'japanese'`.
58
+
- The time zone identifier represents a time zone function that converts between exact time and wall-clock time and vice-versa.
59
+
- The [`Temporal.ZonedDateTime`](./zoneddatetime.md) type encapsulates all of the types above: an exact time (like a [`Temporal.Instant`](./instant.md)), its wall-clock equivalent (like a [`Temporal.PlainDateTime`](./plaindatetime.md)), and the time zone that links the two.
61
60
62
61
There are two ways to get a human-readable calendar date and clock time from a `Temporal` type that stores exact time.
Copy file name to clipboardExpand all lines: docs/calendar-draft.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,9 @@
2
2
3
3
This doc describes a design for first-class support for non-Gregorian [calendars](https://en.wikipedia.org/wiki/Calendar) in Temporal. Although most of this document is based on Temporal.PlainDate, most of this applies to Temporal.PlainDateTime, Temporal.PlainYearMonth, Temporal.PlainMonthDay, and Temporal.PlainTime as well.
4
4
5
-
The approach described in this document was largely adopted, so this document has been superseded by the [`Temporal.Calendar` documentation](./calendar.md).
5
+
The approach described in this document was largely adopted, but most of
6
+
this document's information is nonetheless obsolete, due to removing the
Copy file name to clipboardExpand all lines: docs/calendar-subclass.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Subclass-based Temporal Calendar API
2
2
3
-
[calendar-draft.md](calendar.md) documents the design for calendar support in Temporal based on a single shared Temporal.PlainDate type with a Temporal.Calendar. This document discusses an alternative approach based on subclassing of Temporal.PlainDate types. This idea was not pursued further due to the drawbacks discussed in this document.
3
+
[calendar-draft.md](calendar-draft.md) documents the design for calendar support in Temporal based on a single shared Temporal.PlainDate type with a Temporal.Calendar. This document discusses an alternative approach based on subclassing of Temporal.PlainDate types. This idea was not pursued further due to the drawbacks discussed in this document.
4
4
5
5
In this document, the _Temporal.Calendar Approach_ refers to the solution proposed in [calendar-draft.md](calendar-draft.md), and the _Temporal.PlainDate Subclassing Approach_ refers to the alternative, but eliminated, solution proposed in this document.
0 commit comments