diff --git a/spec.html b/spec.html index c2fcab6a1b7..6ff61534baf 100644 --- a/spec.html +++ b/spec.html @@ -26901,16 +26901,35 @@

Overview of Date Objects and Definitions of Abstract Operations

The following functions are abstract operations that operate on time values (defined in ). Note that, in every case, if any argument to one of these functions is *NaN*, the result will be *NaN*.

-

Time Values and Time Range

+

Time Values

An ECMAScript time value is a Number, either a finite integer representing an instant in time to millisecond precision or *NaN* representing no specific instant.

Time is measured in ECMAScript as milliseconds since midnight at the beginning of 01 January, 1970 UTC. Time in ECMAScript does not observe leap seconds; they are ignored. Time calculations assume each and every day contains exactly msPerDay = 60 × 60 × 24 × 1000 = 86,400,000 milliseconds, to align with the POSIX specification of each and every day containing exactly 86,400 seconds.

-

A Number can exactly represent all integers from -9,007,199,254,740,992 to 9,007,199,254,740,992 ( and ). A time value used for the [[DateValue]] internal slot of a Date instance supports a slightly smaller range of -8,640,000,000,000,000 to 8,640,000,000,000,000 milliseconds (exactly -100,000,000 days to 100,000,000 days relative to midnight at the beginning of 01 January, 1970 UTC).

The exact moment of midnight at the beginning of 01 January, 1970 UTC is represented by the time value *+0*.

- -

The 400 year cycle of the Gregorian calendar contains 97 leap years. This yields an average of 365.2425 days per year, or an average of 31,556,952,000 milliseconds per year under the Gregorian calendar. ECMAScript applies a proleptic Gregorian calendar for all time computations.

-

As specified by this section, the maximum year range a Number can represent exactly with millisecond precision is approximately -285,426 to 285,426 years relative to midnight at the beginning of 01 January, 1970 UTC.

-

As specified by this section, the maximum year range a [[DateValue]] can represent is approximately -273,790 to 273,790 years relative to midnight at the beginning of 01 January, 1970 UTC.

-
+ + +

Time Value Range

+

Arithmetic on time values is exact within the safe integer range of -9,007,199,254,740,991 to 9,007,199,254,740,991 ( and ). To minimize the number of situations that must step outside these bounds (even when calculating leap years, daylight saving transitions, or UTC offset conversion), a time value used for the [[DateValue]] internal slot of a Date instance supports a slightly smaller range of -8,640,000,000,000,000 to 8,640,000,000,000,000 milliseconds (exactly -100,000,000 days to 100,000,000 days relative to midnight at the beginning of 01 January, 1970 UTC).

+ +

The 400 year cycle of the Gregorian calendar contains 97 leap years. This yields an average of 365.2425 days per year, or an average of 31,556,952,000 milliseconds per year under the Gregorian calendar. ECMAScript applies a proleptic Gregorian calendar for all time computations.

+

As specified by this section, the maximum year range a Number can represent exactly with millisecond precision is approximately -285,426 to 285,426 years relative to midnight at the beginning of 01 January, 1970 UTC.

+

As specified by this section, the maximum year range a [[DateValue]] can represent is approximately -273,790 to 273,790 years relative to midnight at the beginning of 01 January, 1970 UTC.

+
+
+ + +

TimeClip ( _time_ )

+

The abstract operation TimeClip calculates a [[DateValue]]-supported time value from its argument, which must be an ECMAScript Number value. It performs the following steps:

+ + 1. If _time_ is not finite, return *NaN*. + 1. If abs(_time_) > 8.64 × 1015, return *NaN*. + 1. Let _clippedTime_ be ! ToInteger(_time_). + 1. If _clippedTime_ is *-0*, set _clippedTime_ to *+0*. + 1. Return _clippedTime_. + + +

The point of step 4 is that an implementation is permitted a choice of internal representations of time values, for example as a 64-bit signed integer or as a 64-bit floating-point value. Depending on the implementation, this internal representation may or may not distinguish *-0* and *+0*.

+
+
@@ -27078,21 +27097,6 @@

MakeDate ( _day_, _time_ )

- -

TimeClip ( _time_ )

-

The abstract operation TimeClip calculates a number of milliseconds from its argument, which must be an ECMAScript Number value. It performs the following steps:

- - 1. If _time_ is not finite, return *NaN*. - 1. If abs(_time_) > 8.64 × 1015, return *NaN*. - 1. Let _clippedTime_ be ! ToInteger(_time_). - 1. If _clippedTime_ is *-0*, set _clippedTime_ to *+0*. - 1. Return _clippedTime_. - - -

The point of step 4 is that an implementation is permitted a choice of internal representations of time values, for example as a 64-bit signed integer or as a 64-bit floating-point value. Depending on the implementation, this internal representation may or may not distinguish *-0* and *+0*.

-
-
-

Date Time String Format

ECMAScript defines a string interchange format for date-times based upon a simplification of the ISO 8601 calendar date extended format. The format is as follows: `YYYY-MM-DDTHH:mm:ss.sssZ`