Skip to content
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

Reference for stage 3 temporal #37344

Merged
merged 46 commits into from
Jan 20, 2025
Merged
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
27a3784
Reference for stage 3 temporal
Josh-Cena Dec 21, 2024
a477fa3
More description
Josh-Cena Dec 24, 2024
9f50952
Duration docs
Josh-Cena Dec 26, 2024
bd0796c
Fix link
Josh-Cena Dec 26, 2024
fbd0601
Complete Duration docs
Josh-Cena Dec 26, 2024
6ab2afd
Instant docs
Josh-Cena Dec 27, 2024
ef79211
Now docs
Josh-Cena Dec 27, 2024
02295b7
TZ and calendar docs
Josh-Cena Dec 27, 2024
0936403
PlainDate docs
Josh-Cena Dec 29, 2024
889b358
Change ISO format description
Josh-Cena Dec 29, 2024
7ca2b31
ZonedDateTime-specific stuff docs
Josh-Cena Dec 29, 2024
7d9cdfe
PlainMonthDay docs, copy date-related fields to PlainDateTime
Josh-Cena Dec 30, 2024
a0ab015
PlainYearMonth docs
Josh-Cena Dec 30, 2024
f4342cf
PlainTime docs
Josh-Cena Dec 31, 2024
4974d24
Intl docs
Josh-Cena Dec 31, 2024
0a172b6
PlainDateTime docs
Josh-Cena Jan 2, 2025
ac18c5f
ZonedDateTime docs, easy part
Josh-Cena Jan 2, 2025
ac298ef
ZonedDateTime docs... and that shall be all
Josh-Cena Jan 3, 2025
f385d12
Simplifications and fixes
Josh-Cena Jan 3, 2025
49485c0
typo
Josh-Cena Jan 3, 2025
2995aaa
Merge branch 'main' into temporal
Josh-Cena Jan 3, 2025
1324f8d
Apply suggestions from code review
Josh-Cena Jan 5, 2025
44f3f7b
ISO 8601 -> RFC 9557
Josh-Cena Jan 5, 2025
a27aa82
Clarify time zone ID input
Josh-Cena Jan 6, 2025
1ad6603
Time zone ID is required
Josh-Cena Jan 6, 2025
f30c94e
Slight reorg
Josh-Cena Jan 7, 2025
7a86d33
Apply suggestions from code review
Josh-Cena Jan 9, 2025
fc843e3
More feedback
Josh-Cena Jan 9, 2025
cb3ce38
More reviews
Josh-Cena Jan 9, 2025
26c065c
Merge branch 'main' into temporal
fiji-flo Jan 10, 2025
0b7b04d
Reviews
Josh-Cena Jan 10, 2025
ce86a53
Reviews, Temporal.Now
Josh-Cena Jan 10, 2025
e28fc82
Mention precision of Temporal.Now methods
Josh-Cena Jan 10, 2025
6756d76
Reviews, landing pages
Josh-Cena Jan 10, 2025
fc28f6b
Apply suggestions from code review
Josh-Cena Jan 10, 2025
2e7b76a
Time zone / calendar / time components
Josh-Cena Jan 13, 2025
2ebbb0e
Reviews, other constructors
Josh-Cena Jan 14, 2025
0f7231a
Reviews, other constructors, arithmetic, monthCode
Josh-Cena Jan 14, 2025
627cdeb
Merge branch 'main' into temporal
Josh-Cena Jan 14, 2025
bf72961
Update index.md
Josh-Cena Jan 14, 2025
0ca21c0
Update index.md
Josh-Cena Jan 14, 2025
25e1bb1
Update index.md
Josh-Cena Jan 14, 2025
aa9c790
Merge branch 'main' into temporal
Josh-Cena Jan 16, 2025
4b68919
Reviews, some (?) conversion methods
Josh-Cena Jan 16, 2025
1a21ed6
Last group of reviews
Josh-Cena Jan 16, 2025
3fd90b9
Mention toTemporalInstant RangeError
Josh-Cena Jan 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
More description
Josh-Cena committed Dec 25, 2024
commit a477fa3afff12b0bba4676a49a6326c5025c169b
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.abs

{{JSRef}}

The **`abs()`** method of {{jsxref("Temporal.Duration")}} instances TODO
The **`abs()`** method of {{jsxref("Temporal.Duration")}} instances returns a new `Temporal.Duration` object with the absolute value of this duration (all fields have the same magnitude, but sign becomes positive).

## Syntax

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.add

{{JSRef}}

The **`add()`** method of {{jsxref("Temporal.Duration")}} instances TODO
The **`add()`** method of {{jsxref("Temporal.Duration")}} instances returns a new `Temporal.Duration` object with the sum of this duration and a given duration. The result is balanced.

## Syntax

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.blank

{{JSRef}}

The **`blank`** accessor property of {{jsxref("Temporal.Duration")}} instances TODO
The **`blank`** accessor property of {{jsxref("Temporal.Duration")}} instances returns a boolean that is `true` if this duration represents a zero duration, and `false` otherwise. Equivalent to `duration.sign === 0`.

## Description

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.compare

{{JSRef}}

The **`Temporal.Duration.compare()`** static method TODO
The **`Temporal.Duration.compare()`** static method returns a number (-1, 0, 1) indicating whether the first duration is shorter, equal to, or longer than the second duration.

## Syntax

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.days

{{JSRef}}

The **`days`** accessor property of {{jsxref("Temporal.Duration")}} instances TODO
The **`days`** accessor property of {{jsxref("Temporal.Duration")}} instances returns an integer representing the number of days in the duration.

## Description

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.from

{{JSRef}}

The **`Temporal.Duration.from()`** static method TODO
The **`Temporal.Duration.from()`** static method creates a new `Temporal.Duration` object from another `Temporal.Duration` object, an object with duration properties, or an ISO 8601 string.

## Syntax

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.hours

{{JSRef}}

The **`hours`** accessor property of {{jsxref("Temporal.Duration")}} instances TODO
The **`hours`** accessor property of {{jsxref("Temporal.Duration")}} instances returns an integer representing the number of hours in the duration.

## Description

Original file line number Diff line number Diff line change
@@ -7,7 +7,13 @@ browser-compat: javascript.builtins.Temporal.Duration

{{JSRef}}

The **`Temporal.Duration`** object TODO
The **`Temporal.Duration`** object represents a difference between two time points, which can be used in datetime arithmetic. It is fundamentally represented as a combination of years, months, weeks, days, hours, minutes, seconds, milliseconds, microseconds, and nanoseconds values.

## Description

### Duration balancing

TODO

## Constructor

@@ -16,68 +22,68 @@ The **`Temporal.Duration`** object TODO

## Static methods

- {{jsxref("Temporal/Duration/compare", "Temporal.Duration.compare()")}}
- : TODO
- {{jsxref("Temporal/Duration/from", "Temporal.Duration.from()")}}
- : TODO
- {{jsxref("Temporal.Duration.compare()")}}
- : Returns a number (-1, 0, 1) indicating whether the first duration is shorter, equal to, or longer than the second duration.
- {{jsxref("Temporal.Duration.from()")}}
- : Creates a new `Temporal.Duration` object from another `Temporal.Duration` object, an object with duration properties, or an ISO 8601 string.

## Instance properties

These properties are defined on `Temporal.Duration.prototype` and shared by all `Temporal.Duration` instances.

- {{jsxref("Temporal/Duration/blank", "Temporal.Duration.prototype.blank")}}
- : TODO
- : Returns a boolean that is `true` if this duration represents a zero duration, and `false` otherwise. Equivalent to `duration.sign === 0`.
- {{jsxref("Object/constructor", "Temporal.Duration.prototype.constructor")}}
- : The constructor function that created the instance object. For `Temporal.Duration` instances, the initial value is the {{jsxref("Temporal/Duration/Duration", "Temporal.Duration()")}} constructor.
- {{jsxref("Temporal/Duration/days", "Temporal.Duration.prototype.days")}}
- : TODO
- : Returns an integer representing the number of days in the duration.
- {{jsxref("Temporal/Duration/hours", "Temporal.Duration.prototype.hours")}}
- : TODO
- : Returns an integer representing the number of hours in the duration.
- {{jsxref("Temporal/Duration/microseconds", "Temporal.Duration.prototype.microseconds")}}
- : TODO
- : Returns an integer representing the number of microseconds in the duration.
- {{jsxref("Temporal/Duration/milliseconds", "Temporal.Duration.prototype.milliseconds")}}
- : TODO
- : Returns an integer representing the number of milliseconds in the duration.
- {{jsxref("Temporal/Duration/minutes", "Temporal.Duration.prototype.minutes")}}
- : TODO
- : Returns an integer representing the number of minutes in the duration.
- {{jsxref("Temporal/Duration/months", "Temporal.Duration.prototype.months")}}
- : TODO
- : Returns an integer representing the number of months in the duration.
- {{jsxref("Temporal/Duration/nanoseconds", "Temporal.Duration.prototype.nanoseconds")}}
- : TODO
- : Returns an integer representing the number of nanoseconds in the duration.
- {{jsxref("Temporal/Duration/seconds", "Temporal.Duration.prototype.seconds")}}
- : TODO
- : Returns an integer representing the number of seconds in the duration.
- {{jsxref("Temporal/Duration/sign", "Temporal.Duration.prototype.sign")}}
- : TODO
- : Returns `1` if this duration is positive, `-1` if negative, and `0` if zero.
- {{jsxref("Temporal/Duration/weeks", "Temporal.Duration.prototype.weeks")}}
- : TODO
- : Returns an integer representing the number of weeks in the duration.
- {{jsxref("Temporal/Duration/years", "Temporal.Duration.prototype.years")}}
- : TODO
- : Returns an integer representing the number of years in the duration.
- `Temporal.Duration.prototype[Symbol.toStringTag]`
- : The initial value of the [`[Symbol.toStringTag]`](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/toStringTag) property is the string `"Temporal.Duration"`. This property is used in {{jsxref("Object.prototype.toString()")}}.

## Instance methods

- {{jsxref("Temporal/Duration/abs", "Temporal.Duration.prototype.abs()")}}
- : TODO
- : Returns a new `Temporal.Duration` object with the absolute value of this duration (all fields keep the same magnitude, but sign becomes positive).
- {{jsxref("Temporal/Duration/add", "Temporal.Duration.prototype.add()")}}
- : TODO
- : Returns a new `Temporal.Duration` object with the sum of this duration and a given duration (in a form convertible by {{jsxref("Temporal.Duration.from()")}}). The result is balanced.
- {{jsxref("Temporal/Duration/negated", "Temporal.Duration.prototype.negated()")}}
- : TODO
- : Returns a new `Temporal.Duration` object with the negated value of this duration (all fields keep the same magnitude, but sign becomes reversed).
- {{jsxref("Temporal/Duration/round", "Temporal.Duration.prototype.round()")}}
- : TODO
- : Returns a new `Temporal.Duration` object with the duration rounded to the given smallest unit and/or balanced to the given largest unit.
- {{jsxref("Temporal/Duration/subtract", "Temporal.Duration.prototype.subtract()")}}
- : TODO
- : Returns a new `Temporal.Duration` object with the difference between this duration and a given duration (in a form convertible by {{jsxref("Temporal.Duration.from()")}}). Equivalent to [adding](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/add) the [negated](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/negated) value of the other duration.
- {{jsxref("Temporal/Duration/toJSON", "Temporal.Duration.prototype.toJSON()")}}
- : TODO
- {{jsxref("Temporal/Duration/toLocaleString", "Temporal.Duration.prototype.toLocaleString()")}}
- : TODO
- {{jsxref("Temporal/Duration/toString", "Temporal.Duration.prototype.toString()")}}
- : TODO
- {{jsxref("Temporal/Duration/total", "Temporal.Duration.prototype.total()")}}
- : TODO
- : Returns a number representing the total duration in the given unit.
- {{jsxref("Temporal/Duration/valueOf", "Temporal.Duration.prototype.valueOf()")}}
- : TODO
- {{jsxref("Temporal/Duration/with", "Temporal.Duration.prototype.with()")}}
- : TODO
- : Returns a new `Temporal.Duration` object representing this duration with some fields replaced by new values.

## Specifications

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.microseconds

{{JSRef}}

The **`microseconds`** accessor property of {{jsxref("Temporal.Duration")}} instances TODO
The **`microseconds`** accessor property of {{jsxref("Temporal.Duration")}} instances returns an integer representing the number of microseconds in the duration.

## Description

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.milliseconds

{{JSRef}}

The **`milliseconds`** accessor property of {{jsxref("Temporal.Duration")}} instances TODO
The **`milliseconds`** accessor property of {{jsxref("Temporal.Duration")}} instances returns an integer representing the number of milliseconds in the duration.

## Description

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.minutes

{{JSRef}}

The **`minutes`** accessor property of {{jsxref("Temporal.Duration")}} instances TODO
The **`minutes`** accessor property of {{jsxref("Temporal.Duration")}} instances returns an integer representing the number of minutes in the duration.

## Description

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.months

{{JSRef}}

The **`months`** accessor property of {{jsxref("Temporal.Duration")}} instances TODO
The **`months`** accessor property of {{jsxref("Temporal.Duration")}} instances returns an integer representing the number of months in the duration.

## Description

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.nanoseconds

{{JSRef}}

The **`nanoseconds`** accessor property of {{jsxref("Temporal.Duration")}} instances TODO
The **`nanoseconds`** accessor property of {{jsxref("Temporal.Duration")}} instances returns an integer representing the number of nanoseconds in the duration.

## Description

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.negated

{{JSRef}}

The **`negated()`** method of {{jsxref("Temporal.Duration")}} instances TODO
The **`negated()`** method of {{jsxref("Temporal.Duration")}} instances returns a new `Temporal.Duration` object with the negated value of this duration (all fields keep the same magnitude, but sign becomes reversed).

## Syntax

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.round

{{JSRef}}

The **`round()`** method of {{jsxref("Temporal.Duration")}} instances TODO
The **`round()`** method of {{jsxref("Temporal.Duration")}} instances returns a new `Temporal.Duration` object with the duration rounded to the given smallest unit and/or balanced to the given largest unit.

## Syntax

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.sign

{{JSRef}}

The **`sign`** accessor property of {{jsxref("Temporal.Duration")}} instances TODO
The **`sign`** accessor property of {{jsxref("Temporal.Duration")}} instances returns `1` if this duration is positive, `-1` if negative, and `0` if zero.

## Description

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.subtract

{{JSRef}}

The **`subtract()`** method of {{jsxref("Temporal.Duration")}} instances TODO
The **`subtract()`** method of {{jsxref("Temporal.Duration")}} instances returns a new `Temporal.Duration` object with the difference between this duration and a given duration. Equivalent to [adding](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/add) the [negated](/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Duration/negated) value of the other duration.

## Syntax

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.total

{{JSRef}}

The **`total()`** method of {{jsxref("Temporal.Duration")}} instances TODO
The **`total()`** method of {{jsxref("Temporal.Duration")}} instances returns a number representing the total duration in the given unit.

## Syntax

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.weeks

{{JSRef}}

The **`weeks`** accessor property of {{jsxref("Temporal.Duration")}} instances TODO
The **`weeks`** accessor property of {{jsxref("Temporal.Duration")}} instances returns an integer representing the number of weeks in the duration.

## Description

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.with

{{JSRef}}

The **`with()`** method of {{jsxref("Temporal.Duration")}} instances TODO
The **`with()`** method of {{jsxref("Temporal.Duration")}} instances returns a new `Temporal.Duration` object representing this duration with some fields replaced by new values.

## Syntax

Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ browser-compat: javascript.builtins.Temporal.Duration.years

{{JSRef}}

The **`years`** accessor property of {{jsxref("Temporal.Duration")}} instances TODO
The **`years`** accessor property of {{jsxref("Temporal.Duration")}} instances returns an integer representing the number of years in the duration.

## Description

Loading