Files
ask262/spec-built/multipage/numbers-and-dates.html
T

2019 lines
376 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html><html lang="en-GB-oxendict"><head><meta name="viewport" content="width=device-width, initial-scale=1"><meta charset="utf-8"><meta property="og:image" content="https://tc39.es/ecmarkup/ecma-logo.png"><meta property="og:title" content="ECMAScript® 2026 Language&nbsp;Specification"><meta property="og:description" content="Introduction
This Ecma Standard defines the ECMAScript 2026 Language. It is the seventeenth edition of the ECMAScript Language Specification. ECMAScript is based on several originating technologies, the most well-known being JavaScript (Netscape) and JScript (Microsoft). The language was invent">
<link rel="icon" href="../img/favicon.ico">
<link rel="stylesheet" href="../assets/css/ecmarkup.css"><link rel="stylesheet" href="../assets/css/print.css" media="print">
<title>ECMAScript® 2026 Language&nbsp;Specification</title><script src="../assets/js/multipage.js?cache=Wu2V1pj2" defer=""></script><script src="../assets/js/ecmarkup.js?cache=BPFBckdu" defer=""></script><link rel="canonical" href="../#sec-numbers-and-dates"></head>
<body><div id="spec-container"><emu-clause id="sec-numbers-and-dates">
<h1><span class="secnum">21</span> Numbers and Dates</h1>
<emu-clause id="sec-number-objects">
<h1><span class="secnum">21.1</span> Number Objects</h1>
<emu-clause id="sec-number-constructor">
<h1><span class="secnum">21.1.1</span> The Number Constructor</h1>
<p>The Number <emu-xref href="#constructor" id="_ref_10161"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>is <dfn tabindex="-1">%Number%</dfn>.</li>
<li>is the initial value of the <emu-val>"Number"</emu-val> property of the <emu-xref href="#sec-global-object" id="_ref_10162"><a href="global-object.html#sec-global-object">global object</a></emu-xref>.</li>
<li>creates and initializes a new Number object when called as a <emu-xref href="#constructor" id="_ref_10163"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>.</li>
<li>performs a type conversion when called as a function rather than as a <emu-xref href="#constructor" id="_ref_10164"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>.</li>
<li>may be used as the value of an <code>extends</code> clause of a class definition. Subclass <emu-xref href="#constructor" id="_ref_10165"><a href="ecmascript-data-types-and-values.html#constructor">constructors</a></emu-xref> that intend to inherit the specified Number behaviour must include a <code>super</code> call to the Number <emu-xref href="#constructor" id="_ref_10166"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> to create and initialize the subclass instance with a <var class="field">[[NumberData]]</var> internal slot.</li>
</ul>
<emu-clause id="sec-number-constructor-number-value" type="built-in function">
<h1><span class="secnum">21.1.1.1</span> Number ( <var>value</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If <var>value</var> is present, then<ol><li>Let <var>prim</var> be ?&nbsp;<emu-xref aoid="ToNumeric" id="_ref_10167"><a href="abstract-operations.html#sec-tonumeric" class="e-user-code">ToNumeric</a></emu-xref>(<var>value</var>).</li><li>If <var>prim</var> <emu-xref href="#sec-ecmascript-language-types-bigint-type" id="_ref_10168"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-bigint-type">is a BigInt</a></emu-xref>, let <var>n</var> be <emu-xref aoid="𝔽" id="_ref_10169"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<emu-xref aoid="" id="_ref_10170"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>prim</var>)).</li><li>Else, let <var>n</var> be <var>prim</var>.</li></ol></li><li>Else,<ol><li>Let <var>n</var> be <emu-val>+0</emu-val><sub>𝔽</sub>.</li></ol></li><li>If NewTarget is <emu-val>undefined</emu-val>, return <var>n</var>.</li><li>Let <var>O</var> be ?&nbsp;<emu-xref aoid="OrdinaryCreateFromConstructor" id="_ref_10171"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarycreatefromconstructor" class="e-user-code">OrdinaryCreateFromConstructor</a></emu-xref>(NewTarget, <emu-val>"%Number.prototype%"</emu-val>, « <var class="field">[[NumberData]]</var>&nbsp;»).</li><li>Set <var>O</var>.<var class="field">[[NumberData]]</var> to <var>n</var>.</li><li>Return <var>O</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-number-constructor">
<h1><span class="secnum">21.1.2</span> Properties of the Number Constructor</h1>
<p>The Number <emu-xref href="#constructor" id="_ref_10172"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-function-prototype-object" id="_ref_10173"><a href="fundamental-objects.html#sec-properties-of-the-function-prototype-object">%Function.prototype%</a></emu-xref>.</li>
<li>has the following properties:</li>
</ul>
<emu-clause id="sec-number.epsilon">
<h1><span class="secnum">21.1.2.1</span> Number.EPSILON</h1>
<p>The value of <code>Number.EPSILON</code> is the <emu-xref href="#number-value-for" id="_ref_10174"><a href="ecmascript-data-types-and-values.html#number-value-for">Number value for</a></emu-xref> the magnitude of the difference between 1 and the smallest value greater than 1 that is representable as a Number value, which is approximately 2.2204460492503130808472633361816 × 10<sup>-16</sup>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-number.isfinite" type="built-in function">
<h1><span class="secnum">21.1.2.2</span> Number.isFinite ( <var>number</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If <var>number</var> <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_10175"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">is not a Number</a></emu-xref>, return <emu-val>false</emu-val>.</li><li>If <var>number</var> is not <emu-xref href="#finite" id="_ref_10176"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, return <emu-val>false</emu-val>.</li><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-number.isinteger" type="built-in function">
<h1><span class="secnum">21.1.2.3</span> Number.isInteger ( <var>number</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If <var>number</var> is an <emu-xref href="#integral-number" id="_ref_10177"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>, return <emu-val>true</emu-val>.</li><li>Return <emu-val>false</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-number.isnan" type="built-in function">
<h1><span class="secnum">21.1.2.4</span> Number.isNaN ( <var>number</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If <var>number</var> <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_10178"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">is not a Number</a></emu-xref>, return <emu-val>false</emu-val>.</li><li>If <var>number</var> is <emu-val>NaN</emu-val>, return <emu-val>true</emu-val>.</li><li>Return <emu-val>false</emu-val>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>This function differs from the global isNaN function (<emu-xref href="#sec-isnan-number" id="_ref_634"><a href="global-object.html#sec-isnan-number">19.2.3</a></emu-xref>) in that it does not convert its argument to a Number before determining whether it is <emu-val>NaN</emu-val>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-number.issafeinteger" type="built-in function">
<h1><span class="secnum">21.1.2.5</span> Number.isSafeInteger ( <var>number</var> )</h1>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>An <emu-xref href="#integer" id="_ref_10179"><a href="notational-conventions.html#integer">integer</a></emu-xref> <var>n</var> is a "<dfn id="safe-integer" tabindex="-1">safe integer</dfn>" if and only if the <emu-xref href="#number-value-for" id="_ref_10180"><a href="ecmascript-data-types-and-values.html#number-value-for">Number value for</a></emu-xref> <var>n</var> is not the <emu-xref href="#number-value-for" id="_ref_10181"><a href="ecmascript-data-types-and-values.html#number-value-for">Number value for</a></emu-xref> any other <emu-xref href="#integer" id="_ref_10182"><a href="notational-conventions.html#integer">integer</a></emu-xref>.</p>
</div></emu-note>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If <var>number</var> is an <emu-xref href="#integral-number" id="_ref_10183"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>, then<ol><li>If <emu-xref aoid="abs" id="_ref_10184"><a href="notational-conventions.html#eqn-abs">abs</a></emu-xref>(<emu-xref aoid="" id="_ref_10185"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>number</var>)) ≤ 2<sup>53</sup> - 1, return <emu-val>true</emu-val>.</li></ol></li><li>Return <emu-val>false</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-number.max_safe_integer">
<h1><span class="secnum">21.1.2.6</span> Number.MAX_SAFE_INTEGER</h1>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>Due to rounding behaviour necessitated by precision limitations of <emu-xref href="#sec-bibliography" id="_ref_10186"><a href="bibliography.html#sec-bibliography">IEEE 754-2019</a></emu-xref>, the <emu-xref href="#number-value-for" id="_ref_10187"><a href="ecmascript-data-types-and-values.html#number-value-for">Number value for</a></emu-xref> every <emu-xref href="#integer" id="_ref_10188"><a href="notational-conventions.html#integer">integer</a></emu-xref> greater than <code>Number.MAX_SAFE_INTEGER</code> is shared with at least one other <emu-xref href="#integer" id="_ref_10189"><a href="notational-conventions.html#integer">integer</a></emu-xref>. Such large-magnitude <emu-xref href="#integer" id="_ref_10190"><a href="notational-conventions.html#integer">integers</a></emu-xref> are therefore not <emu-xref href="#safe-integer" id="_ref_635"><a href="numbers-and-dates.html#safe-integer">safe</a></emu-xref>, and are not guaranteed to be exactly representable as Number values or even to be distinguishable from each other. For example, both <code>9007199254740992</code> and <code>9007199254740993</code> evaluate to the Number value <emu-val>9007199254740992</emu-val><sub>𝔽</sub>.</p>
</div></emu-note>
<p>The value of <code>Number.MAX_SAFE_INTEGER</code> is <emu-val>9007199254740991</emu-val><sub>𝔽</sub> (<emu-xref aoid="𝔽" id="_ref_10191"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(2<sup>53</sup> - 1)).</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-number.max_value">
<h1><span class="secnum">21.1.2.7</span> Number.MAX_VALUE</h1>
<p>The value of <code>Number.MAX_VALUE</code> is the largest positive <emu-xref href="#finite" id="_ref_10192"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> value of the <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_10193"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">Number type</a></emu-xref>, which is approximately <emu-eqn class="inline">1.7976931348623157 × 10<sup>308</sup></emu-eqn>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-number.min_safe_integer">
<h1><span class="secnum">21.1.2.8</span> Number.MIN_SAFE_INTEGER</h1>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>Due to rounding behaviour necessitated by precision limitations of <emu-xref href="#sec-bibliography" id="_ref_10194"><a href="bibliography.html#sec-bibliography">IEEE 754-2019</a></emu-xref>, the <emu-xref href="#number-value-for" id="_ref_10195"><a href="ecmascript-data-types-and-values.html#number-value-for">Number value for</a></emu-xref> every <emu-xref href="#integer" id="_ref_10196"><a href="notational-conventions.html#integer">integer</a></emu-xref> less than <code>Number.MIN_SAFE_INTEGER</code> is shared with at least one other <emu-xref href="#integer" id="_ref_10197"><a href="notational-conventions.html#integer">integer</a></emu-xref>. Such large-magnitude <emu-xref href="#integer" id="_ref_10198"><a href="notational-conventions.html#integer">integers</a></emu-xref> are therefore not <emu-xref href="#safe-integer" id="_ref_636"><a href="numbers-and-dates.html#safe-integer">safe</a></emu-xref>, and are not guaranteed to be exactly representable as Number values or even to be distinguishable from each other. For example, both <code>-9007199254740992</code> and <code>-9007199254740993</code> evaluate to the Number value <emu-val>-9007199254740992</emu-val><sub>𝔽</sub>.</p>
</div></emu-note>
<p>The value of <code>Number.MIN_SAFE_INTEGER</code> is <emu-val>-9007199254740991</emu-val><sub>𝔽</sub> (<emu-xref aoid="𝔽" id="_ref_10199"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(-(2<sup>53</sup> - 1))).</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-number.min_value">
<h1><span class="secnum">21.1.2.9</span> Number.MIN_VALUE</h1>
<p>The value of <code>Number.MIN_VALUE</code> is the smallest positive value of the <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_10200"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">Number type</a></emu-xref>, which is approximately <emu-eqn class="inline">5 × 10<sup>-324</sup></emu-eqn>.</p>
<p>In the <emu-xref href="#sec-bibliography" id="_ref_10201"><a href="bibliography.html#sec-bibliography">IEEE 754-2019</a></emu-xref> double precision binary representation, the smallest possible value is a denormalized number. If an implementation does not support denormalized values, the value of <code>Number.MIN_VALUE</code> must be the smallest non-zero positive value that can actually be represented by the implementation.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-number.nan">
<h1><span class="secnum">21.1.2.10</span> Number.NaN</h1>
<p>The value of <code>Number.NaN</code> is <emu-val>NaN</emu-val>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-number.negative_infinity">
<h1><span class="secnum">21.1.2.11</span> Number.NEGATIVE_INFINITY</h1>
<p>The value of <code>Number.NEGATIVE_INFINITY</code> is <emu-val>-∞</emu-val><sub>𝔽</sub>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-number.parsefloat" type="built-in function">
<h1><span class="secnum">21.1.2.12</span> Number.parseFloat ( <var>string</var> )</h1>
<p>The initial value of the <emu-val>"parseFloat"</emu-val> property is <emu-xref href="#sec-parsefloat-string" id="_ref_10202"><a href="global-object.html#sec-parsefloat-string">%parseFloat%</a></emu-xref>.</p>
</emu-clause>
<emu-clause id="sec-number.parseint" type="built-in function">
<h1><span class="secnum">21.1.2.13</span> Number.parseInt ( <var>string</var>, <var>radix</var> )</h1>
<p>The initial value of the <emu-val>"parseInt"</emu-val> property is <emu-xref href="#sec-parseint-string-radix" id="_ref_10203"><a href="global-object.html#sec-parseint-string-radix">%parseInt%</a></emu-xref>.</p>
</emu-clause>
<emu-clause id="sec-number.positive_infinity">
<h1><span class="secnum">21.1.2.14</span> Number.POSITIVE_INFINITY</h1>
<p>The value of <code>Number.POSITIVE_INFINITY</code> is <emu-val>+∞</emu-val><sub>𝔽</sub>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-number.prototype">
<h1><span class="secnum">21.1.2.15</span> Number.prototype</h1>
<p>The initial value of <code>Number.prototype</code> is the <emu-xref href="#sec-properties-of-the-number-prototype-object" id="_ref_10204"><a href="numbers-and-dates.html#sec-properties-of-the-number-prototype-object">Number prototype object</a></emu-xref>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-number-prototype-object">
<h1><span class="secnum">21.1.3</span> Properties of the Number Prototype Object</h1>
<p>The <dfn tabindex="-1">Number prototype object</dfn>:</p>
<ul>
<li>is <dfn tabindex="-1">%Number.prototype%</dfn>.</li>
<li>is an <emu-xref href="#ordinary-object" id="_ref_10205"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref>.</li>
<li>is itself a Number object; it has a <var class="field">[[NumberData]]</var> internal slot with the value <emu-val>+0</emu-val><sub>𝔽</sub>.</li>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-object-prototype-object" id="_ref_10206"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>.</li>
</ul>
<p>Unless explicitly stated otherwise, the methods of the Number prototype object defined below are not generic and the <emu-val>this</emu-val> value passed to them must be either a Number value or an object that has a <var class="field">[[NumberData]]</var> internal slot that has been initialized to a Number value.</p>
<p>The phrase “this Number value” within the specification of a method refers to the result returned by calling the abstract operation <emu-xref aoid="ThisNumberValue" id="_ref_10207"><a href="numbers-and-dates.html#sec-thisnumbervalue">ThisNumberValue</a></emu-xref> with the <emu-val>this</emu-val> value of the method invocation passed as the argument.</p>
<emu-clause id="sec-number.prototype.constructor">
<h1><span class="secnum">21.1.3.1</span> Number.prototype.constructor</h1>
<p>The initial value of <code>Number.prototype.constructor</code> is <emu-xref href="#sec-number-constructor" id="_ref_10208"><a href="numbers-and-dates.html#sec-number-constructor">%Number%</a></emu-xref>.</p>
</emu-clause>
<emu-clause id="sec-number.prototype.toexponential" type="built-in function">
<h1><span class="secnum">21.1.3.2</span> Number.prototype.toExponential ( <var>fractionDigits</var> )</h1>
<p>This method returns a String containing this Number value represented in decimal exponential notation with one digit before the significand's decimal point and <var>fractionDigits</var> digits after the significand's decimal point. If <var>fractionDigits</var> is <emu-val>undefined</emu-val>, it includes as many significand digits as necessary to uniquely specify the Number (just like in <emu-xref aoid="ToString" id="_ref_10209"><a href="abstract-operations.html#sec-tostring">ToString</a></emu-xref> except that in this case the Number is always output in exponential notation).</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>x</var> be ?&nbsp;<emu-xref aoid="ThisNumberValue" id="_ref_10210"><a href="numbers-and-dates.html#sec-thisnumbervalue">ThisNumberValue</a></emu-xref>(<emu-val>this</emu-val> value).</li><li>Let <var>f</var> be ?&nbsp;<emu-xref aoid="ToIntegerOrInfinity" id="_ref_10211"><a href="abstract-operations.html#sec-tointegerorinfinity" class="e-user-code">ToIntegerOrInfinity</a></emu-xref>(<var>fractionDigits</var>).</li><li><emu-xref href="#assert" id="_ref_10212"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: If <var>fractionDigits</var> is <emu-val>undefined</emu-val>, then <var>f</var> is 0.</li><li>If <var>x</var> is not <emu-xref href="#finite" id="_ref_10213"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, return <emu-xref aoid="Number::toString" id="_ref_10214"><a href="ecmascript-data-types-and-values.html#sec-numeric-types-number-tostring">Number::toString</a></emu-xref>(<var>x</var>, 10).</li><li>If <var>f</var> &lt; 0 or <var>f</var> &gt; 100, throw a <emu-val>RangeError</emu-val> exception.</li><li>Set <var>x</var> to <emu-xref aoid="" id="_ref_10215"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>x</var>).</li><li>Let <var>s</var> be the empty String.</li><li>If <var>x</var> &lt; 0, then<ol><li>Set <var>s</var> to <emu-val>"-"</emu-val>.</li><li>Set <var>x</var> to -<var>x</var>.</li></ol></li><li>If <var>x</var> = 0, then<ol><li>Let <var>m</var> be the String value consisting of <var>f</var> + 1 occurrences of the code unit 0x0030 (DIGIT ZERO).</li><li>Let <var>e</var> be 0.</li></ol></li><li>Else,<ol><li>If <var>fractionDigits</var> is not <emu-val>undefined</emu-val>, then<ol><li>Let <var>e</var> and <var>n</var> be <emu-xref href="#integer" id="_ref_10216"><a href="notational-conventions.html#integer">integers</a></emu-xref> such that 10<sup><var>f</var></sup><var>n</var> &lt; 10<sup><var>f</var> + 1</sup> and for which <var>n</var> × 10<sup><var>e</var> - <var>f</var></sup> - <var>x</var> is as close to zero as possible. If there are two such sets of <var>e</var> and <var>n</var>, pick the <var>e</var> and <var>n</var> for which <var>n</var> × 10<sup><var>e</var> - <var>f</var></sup> is larger.</li></ol></li><li>Else,<ol><li id="step-number-proto-toexponential-intermediate-values">Let <var>e</var>, <var>n</var>, and <var>ff</var> be <emu-xref href="#integer" id="_ref_10217"><a href="notational-conventions.html#integer">integers</a></emu-xref> such that <var>ff</var> ≥ 0, 10<sup><var>ff</var></sup><var>n</var> &lt; 10<sup><var>ff</var> + 1</sup>, <emu-xref aoid="𝔽" id="_ref_10218"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>n</var> × 10<sup><var>e</var> - <var>ff</var></sup>) is <emu-xref aoid="𝔽" id="_ref_10219"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>x</var>), and <var>ff</var> is as small as possible. Note that the decimal representation of <var>n</var> has <var>ff</var> + 1 digits, <var>n</var> is not divisible by 10, and the least significant digit of <var>n</var> is not necessarily uniquely determined by these criteria.</li><li>Set <var>f</var> to <var>ff</var>.</li></ol></li><li>Let <var>m</var> be the String value consisting of the digits of the decimal representation of <var>n</var> (in order, with no leading zeroes).</li></ol></li><li>If <var>f</var> ≠ 0, then<ol><li>Let <var>a</var> be the first code unit of <var>m</var>.</li><li>Let <var>b</var> be the other <var>f</var> code units of <var>m</var>.</li><li>Set <var>m</var> to the <emu-xref href="#string-concatenation" id="_ref_10220"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>a</var>, <emu-val>"."</emu-val>, and <var>b</var>.</li></ol></li><li>If <var>e</var> = 0, then<ol><li>Let <var>c</var> be <emu-val>"+"</emu-val>.</li><li>Let <var>d</var> be <emu-val>"0"</emu-val>.</li></ol></li><li>Else,<ol><li>If <var>e</var> &gt; 0, then<ol><li>Let <var>c</var> be <emu-val>"+"</emu-val>.</li></ol></li><li>Else,<ol><li><emu-xref href="#assert" id="_ref_10221"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>e</var> &lt; 0.</li><li>Let <var>c</var> be <emu-val>"-"</emu-val>.</li><li>Set <var>e</var> to -<var>e</var>.</li></ol></li><li>Let <var>d</var> be the String value consisting of the digits of the decimal representation of <var>e</var> (in order, with no leading zeroes).</li></ol></li><li>Set <var>m</var> to the <emu-xref href="#string-concatenation" id="_ref_10222"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>m</var>, <emu-val>"e"</emu-val>, <var>c</var>, and <var>d</var>.</li><li>Return the <emu-xref href="#string-concatenation" id="_ref_10223"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>s</var> and <var>m</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>For implementations that provide more accurate conversions than required by the rules above, it is recommended that the following alternative version of step <emu-xref href="#step-number-proto-toexponential-intermediate-values" id="_ref_637"><a href="numbers-and-dates.html#step-number-proto-toexponential-intermediate-values">10.b.i</a></emu-xref> be used as a guideline:</p>
<emu-alg replaces-step="step-number-proto-toexponential-intermediate-values"><ol start="1" class="nested-twice"><li>Let <var>e</var>, <var>n</var>, and <var>ff</var> be <emu-xref href="#integer" id="_ref_10224"><a href="notational-conventions.html#integer">integers</a></emu-xref> such that <var>ff</var> ≥ 0, 10<sup><var>ff</var></sup><var>n</var> &lt; 10<sup><var>ff</var> + 1</sup>, <emu-xref aoid="𝔽" id="_ref_10225"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>n</var> × 10<sup><var>e</var> - <var>ff</var></sup>) is <emu-xref aoid="𝔽" id="_ref_10226"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>x</var>), and <var>ff</var> is as small as possible. If there are multiple possibilities for <var>n</var>, choose the value of <var>n</var> for which <emu-xref aoid="𝔽" id="_ref_10227"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>n</var> × 10<sup><var>e</var> - <var>ff</var></sup>) is closest in value to <emu-xref aoid="𝔽" id="_ref_10228"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>x</var>). If there are two such possible values of <var>n</var>, choose the one that is even.</li></ol></emu-alg>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-number.prototype.tofixed" type="built-in function">
<h1><span class="secnum">21.1.3.3</span> Number.prototype.toFixed ( <var>fractionDigits</var> )</h1>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p>This method returns a String containing this Number value represented in decimal fixed-point notation with <var>fractionDigits</var> digits after the decimal point. If <var>fractionDigits</var> is <emu-val>undefined</emu-val>, 0 is assumed.</p>
</div></emu-note>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>x</var> be ?&nbsp;<emu-xref aoid="ThisNumberValue" id="_ref_10229"><a href="numbers-and-dates.html#sec-thisnumbervalue">ThisNumberValue</a></emu-xref>(<emu-val>this</emu-val> value).</li><li>Let <var>f</var> be ?&nbsp;<emu-xref aoid="ToIntegerOrInfinity" id="_ref_10230"><a href="abstract-operations.html#sec-tointegerorinfinity" class="e-user-code">ToIntegerOrInfinity</a></emu-xref>(<var>fractionDigits</var>).</li><li><emu-xref href="#assert" id="_ref_10231"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: If <var>fractionDigits</var> is <emu-val>undefined</emu-val>, then <var>f</var> is 0.</li><li>If <var>f</var> is not <emu-xref href="#finite" id="_ref_10232"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, throw a <emu-val>RangeError</emu-val> exception.</li><li>If <var>f</var> &lt; 0 or <var>f</var> &gt; 100, throw a <emu-val>RangeError</emu-val> exception.</li><li>If <var>x</var> is not <emu-xref href="#finite" id="_ref_10233"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, return <emu-xref aoid="Number::toString" id="_ref_10234"><a href="ecmascript-data-types-and-values.html#sec-numeric-types-number-tostring">Number::toString</a></emu-xref>(<var>x</var>, 10).</li><li>Set <var>x</var> to <emu-xref aoid="" id="_ref_10235"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>x</var>).</li><li>Let <var>s</var> be the empty String.</li><li>If <var>x</var> &lt; 0, then<ol><li>Set <var>s</var> to <emu-val>"-"</emu-val>.</li><li>Set <var>x</var> to -<var>x</var>.</li></ol></li><li>If <var>x</var> ≥ 10<sup>21</sup>, then<ol><li>Let <var>m</var> be !&nbsp;<emu-xref aoid="ToString" id="_ref_10236"><a href="abstract-operations.html#sec-tostring">ToString</a></emu-xref>(<emu-xref aoid="𝔽" id="_ref_10237"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>x</var>)).</li></ol></li><li>Else,<ol><li>Let <var>n</var> be an <emu-xref href="#integer" id="_ref_10238"><a href="notational-conventions.html#integer">integer</a></emu-xref> for which <var>n</var> / 10<sup><var>f</var></sup> - <var>x</var> is as close to zero as possible. If there are two such <var>n</var>, pick the larger <var>n</var>.</li><li>If <var>n</var> = 0, let <var>m</var> be <emu-val>"0"</emu-val>; else let <var>m</var> be the String value consisting of the digits of the decimal representation of <var>n</var> (in order, with no leading zeroes).</li><li>If <var>f</var> ≠ 0, then<ol><li>Let <var>k</var> be the length of <var>m</var>.</li><li>If <var>k</var><var>f</var>, then<ol><li>Let <var>z</var> be the String value consisting of <var>f</var> + 1 - <var>k</var> occurrences of the code unit 0x0030 (DIGIT ZERO).</li><li>Set <var>m</var> to the <emu-xref href="#string-concatenation" id="_ref_10239"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>z</var> and <var>m</var>.</li><li>Set <var>k</var> to <var>f</var> + 1.</li></ol></li><li>Let <var>a</var> be the first <var>k</var> - <var>f</var> code units of <var>m</var>.</li><li>Let <var>b</var> be the other <var>f</var> code units of <var>m</var>.</li><li>Set <var>m</var> to the <emu-xref href="#string-concatenation" id="_ref_10240"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>a</var>, <emu-val>"."</emu-val>, and <var>b</var>.</li></ol></li></ol></li><li>Return the <emu-xref href="#string-concatenation" id="_ref_10241"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>s</var> and <var>m</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note 2</span><div class="note-contents">
<p>The output of <code>toFixed</code> may be more precise than <code>toString</code> for some values because toString only prints enough significant digits to distinguish the number from adjacent Number values. For example,</p>
<p>
<code>(1000000000000000128).toString()</code> returns <emu-val>"1000000000000000100"</emu-val>, while<br>
<code>(1000000000000000128).toFixed(0)</code> returns <emu-val>"1000000000000000128"</emu-val>.
</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-number.prototype.tolocalestring" type="built-in function">
<h1><span class="secnum">21.1.3.4</span> Number.prototype.toLocaleString ( [ <var>reserved1</var> [ , <var>reserved2</var> ] ] )</h1>
<p>An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement this method as specified in the ECMA-402 specification. If an ECMAScript implementation does not include the ECMA-402 API the following specification of this method is used:</p>
<p>This method produces a String value that represents this Number value formatted according to the conventions of the <emu-xref href="#host-environment" id="_ref_10242"><a href="overview.html#host-environment">host environment</a></emu-xref>'s current locale. This method is <emu-xref href="#implementation-defined" id="_ref_10243"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref>, and it is permissible, but not encouraged, for it to return the same thing as <code>toString</code>.</p>
<p>The meanings of the optional parameters to this method are defined in the ECMA-402 specification; implementations that do not include ECMA-402 support must not use those parameter positions for anything else.</p>
</emu-clause>
<emu-clause id="sec-number.prototype.toprecision" type="built-in function">
<h1><span class="secnum">21.1.3.5</span> Number.prototype.toPrecision ( <var>precision</var> )</h1>
<p>This method returns a String containing this Number value represented either in decimal exponential notation with one digit before the significand's decimal point and <emu-eqn class="inline"><var>precision</var> - 1</emu-eqn> digits after the significand's decimal point or in decimal fixed notation with <var>precision</var> significant digits. If <var>precision</var> is <emu-val>undefined</emu-val>, it calls <emu-xref aoid="ToString" id="_ref_10244"><a href="abstract-operations.html#sec-tostring">ToString</a></emu-xref> instead.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>x</var> be ?&nbsp;<emu-xref aoid="ThisNumberValue" id="_ref_10245"><a href="numbers-and-dates.html#sec-thisnumbervalue">ThisNumberValue</a></emu-xref>(<emu-val>this</emu-val> value).</li><li>If <var>precision</var> is <emu-val>undefined</emu-val>, return !&nbsp;<emu-xref aoid="ToString" id="_ref_10246"><a href="abstract-operations.html#sec-tostring">ToString</a></emu-xref>(<var>x</var>).</li><li>Let <var>p</var> be ?&nbsp;<emu-xref aoid="ToIntegerOrInfinity" id="_ref_10247"><a href="abstract-operations.html#sec-tointegerorinfinity" class="e-user-code">ToIntegerOrInfinity</a></emu-xref>(<var>precision</var>).</li><li>If <var>x</var> is not <emu-xref href="#finite" id="_ref_10248"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, return <emu-xref aoid="Number::toString" id="_ref_10249"><a href="ecmascript-data-types-and-values.html#sec-numeric-types-number-tostring">Number::toString</a></emu-xref>(<var>x</var>, 10).</li><li>If <var>p</var> &lt; 1 or <var>p</var> &gt; 100, throw a <emu-val>RangeError</emu-val> exception.</li><li>Set <var>x</var> to <emu-xref aoid="" id="_ref_10250"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>x</var>).</li><li>Let <var>s</var> be the empty String.</li><li>If <var>x</var> &lt; 0, then<ol><li>Set <var>s</var> to the code unit 0x002D (HYPHEN-MINUS).</li><li>Set <var>x</var> to -<var>x</var>.</li></ol></li><li>If <var>x</var> = 0, then<ol><li>Let <var>m</var> be the String value consisting of <var>p</var> occurrences of the code unit 0x0030 (DIGIT ZERO).</li><li>Let <var>e</var> be 0.</li></ol></li><li>Else,<ol><li>Let <var>e</var> and <var>n</var> be <emu-xref href="#integer" id="_ref_10251"><a href="notational-conventions.html#integer">integers</a></emu-xref> such that 10<sup><var>p</var> - 1</sup><var>n</var> &lt; 10<sup><var>p</var></sup> and for which <var>n</var> × 10<sup><var>e</var> - <var>p</var> + 1</sup> - <var>x</var> is as close to zero as possible. If there are two such sets of <var>e</var> and <var>n</var>, pick the <var>e</var> and <var>n</var> for which <var>n</var> × 10<sup><var>e</var> - <var>p</var> + 1</sup> is larger.</li><li>Let <var>m</var> be the String value consisting of the digits of the decimal representation of <var>n</var> (in order, with no leading zeroes).</li><li>If <var>e</var> &lt; -6 or <var>e</var><var>p</var>, then<ol><li><emu-xref href="#assert" id="_ref_10252"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>e</var> ≠ 0.</li><li>If <var>p</var> ≠ 1, then<ol><li>Let <var>a</var> be the first code unit of <var>m</var>.</li><li>Let <var>b</var> be the other <var>p</var> - 1 code units of <var>m</var>.</li><li>Set <var>m</var> to the <emu-xref href="#string-concatenation" id="_ref_10253"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>a</var>, <emu-val>"."</emu-val>, and <var>b</var>.</li></ol></li><li>If <var>e</var> &gt; 0, then<ol><li>Let <var>c</var> be the code unit 0x002B (PLUS SIGN).</li></ol></li><li>Else,<ol><li><emu-xref href="#assert" id="_ref_10254"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>e</var> &lt; 0.</li><li>Let <var>c</var> be the code unit 0x002D (HYPHEN-MINUS).</li><li>Set <var>e</var> to -<var>e</var>.</li></ol></li><li>Let <var>d</var> be the String value consisting of the digits of the decimal representation of <var>e</var> (in order, with no leading zeroes).</li><li>Return the <emu-xref href="#string-concatenation" id="_ref_10255"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>s</var>, <var>m</var>, the code unit 0x0065 (LATIN SMALL LETTER E), <var>c</var>, and <var>d</var>.</li></ol></li></ol></li><li>If <var>e</var> = <var>p</var> - 1, return the <emu-xref href="#string-concatenation" id="_ref_10256"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>s</var> and <var>m</var>.</li><li>If <var>e</var> ≥ 0, then<ol><li>Set <var>m</var> to the <emu-xref href="#string-concatenation" id="_ref_10257"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of the first <var>e</var> + 1 code units of <var>m</var>, the code unit 0x002E (FULL STOP), and the remaining <var>p</var> - (<var>e</var> + 1) code units of <var>m</var>.</li></ol></li><li>Else,<ol><li>Set <var>m</var> to the <emu-xref href="#string-concatenation" id="_ref_10258"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of the code unit 0x0030 (DIGIT ZERO), the code unit 0x002E (FULL STOP), -(<var>e</var> + 1) occurrences of the code unit 0x0030 (DIGIT ZERO), and the String <var>m</var>.</li></ol></li><li>Return the <emu-xref href="#string-concatenation" id="_ref_10259"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>s</var> and <var>m</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-number.prototype.tostring" type="built-in function">
<h1><span class="secnum">21.1.3.6</span> Number.prototype.toString ( [ <var>radix</var> ] )</h1>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The optional <var>radix</var> should be an <emu-xref href="#integral-number" id="_ref_10260"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> value in the <emu-xref href="#inclusive-interval" id="_ref_10261"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from <emu-val>2</emu-val><sub>𝔽</sub> to <emu-val>36</emu-val><sub>𝔽</sub>. If <var>radix</var> is <emu-val>undefined</emu-val> then <emu-val>10</emu-val><sub>𝔽</sub> is used as the value of <var>radix</var>.</p>
</div></emu-note>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>x</var> be ?&nbsp;<emu-xref aoid="ThisNumberValue" id="_ref_10262"><a href="numbers-and-dates.html#sec-thisnumbervalue">ThisNumberValue</a></emu-xref>(<emu-val>this</emu-val> value).</li><li>If <var>radix</var> is <emu-val>undefined</emu-val>, let <var>radixMV</var> be 10.</li><li>Else, let <var>radixMV</var> be ?&nbsp;<emu-xref aoid="ToIntegerOrInfinity" id="_ref_10263"><a href="abstract-operations.html#sec-tointegerorinfinity" class="e-user-code">ToIntegerOrInfinity</a></emu-xref>(<var>radix</var>).</li><li>If <var>radixMV</var> is not in the <emu-xref href="#inclusive-interval" id="_ref_10264"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 2 to 36, throw a <emu-val>RangeError</emu-val> exception.</li><li>Return <emu-xref aoid="Number::toString" id="_ref_10265"><a href="ecmascript-data-types-and-values.html#sec-numeric-types-number-tostring">Number::toString</a></emu-xref>(<var>x</var>, <var>radixMV</var>).</li></ol></emu-alg>
<p>This method is not generic; it throws a <emu-val>TypeError</emu-val> exception if its <emu-val>this</emu-val> value <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_10266"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">is not a Number</a></emu-xref> or a Number object. Therefore, it cannot be transferred to other kinds of objects for use as a method.</p>
<p>The <emu-val>"length"</emu-val> property of this method is <emu-val>1</emu-val><sub>𝔽</sub>.</p>
</emu-clause>
<emu-clause id="sec-number.prototype.valueof" type="built-in function">
<h1><span class="secnum">21.1.3.7</span> Number.prototype.valueOf ( )</h1>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="ThisNumberValue" id="_ref_10267"><a href="numbers-and-dates.html#sec-thisnumbervalue">ThisNumberValue</a></emu-xref>(<emu-val>this</emu-val> value).</li></ol></emu-alg>
<emu-clause id="sec-thisnumbervalue" type="abstract operation" oldids="thisnumbervalue" aoid="ThisNumberValue"><span id="thisnumbervalue"></span>
<h1><span class="secnum">21.1.3.7.1</span> ThisNumberValue ( <var>value</var> )</h1>
<p>The abstract operation ThisNumberValue takes argument <var>value</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_10268"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_10269"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a Number or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_10270"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>value</var> <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_10271"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">is a Number</a></emu-xref>, return <var>value</var>.</li><li>If <var>value</var> <emu-xref href="#sec-object-type" id="_ref_10272"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref> and <var>value</var> has a <var class="field">[[NumberData]]</var> internal slot, then<ol><li>Let <var>n</var> be <var>value</var>.<var class="field">[[NumberData]]</var>.</li><li><emu-xref href="#assert" id="_ref_10273"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>n</var> <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_10274"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">is a Number</a></emu-xref>.</li><li>Return <var>n</var>.</li></ol></li><li>Throw a <emu-val>TypeError</emu-val> exception.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-number-instances">
<h1><span class="secnum">21.1.4</span> Properties of Number Instances</h1>
<p>Number instances are <emu-xref href="#ordinary-object" id="_ref_10275"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref> that inherit properties from the <emu-xref href="#sec-properties-of-the-number-prototype-object" id="_ref_10276"><a href="numbers-and-dates.html#sec-properties-of-the-number-prototype-object">Number prototype object</a></emu-xref>. Number instances also have a <var class="field">[[NumberData]]</var> internal slot. The <var class="field">[[NumberData]]</var> internal slot is the Number value represented by this Number object.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-bigint-objects">
<h1><span class="secnum">21.2</span> BigInt Objects</h1>
<emu-clause id="sec-bigint-constructor">
<h1><span class="secnum">21.2.1</span> The BigInt Constructor</h1>
<p>The BigInt <emu-xref href="#constructor" id="_ref_10277"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>is <dfn tabindex="-1">%BigInt%</dfn>.</li>
<li>is the initial value of the <emu-val>"BigInt"</emu-val> property of the <emu-xref href="#sec-global-object" id="_ref_10278"><a href="global-object.html#sec-global-object">global object</a></emu-xref>.</li>
<li>performs a type conversion when called as a function rather than as a <emu-xref href="#constructor" id="_ref_10279"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>.</li>
<li>is not intended to be used with the <code>new</code> operator or to be subclassed. It may be used as the value of an <code>extends</code> clause of a class definition but a <code>super</code> call to the BigInt <emu-xref href="#constructor" id="_ref_10280"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> will cause an exception.</li>
</ul>
<emu-clause id="sec-bigint-constructor-number-value" type="built-in function">
<h1><span class="secnum">21.2.1.1</span> BigInt ( <var>value</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If NewTarget is not <emu-val>undefined</emu-val>, throw a <emu-val>TypeError</emu-val> exception.</li><li>Let <var>prim</var> be ?&nbsp;<emu-xref aoid="ToPrimitive" id="_ref_10281"><a href="abstract-operations.html#sec-toprimitive" class="e-user-code">ToPrimitive</a></emu-xref>(<var>value</var>, <emu-const>number</emu-const>).</li><li>If <var>prim</var> <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_10282"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">is a Number</a></emu-xref>, return ?&nbsp;<emu-xref aoid="NumberToBigInt" id="_ref_10283"><a href="numbers-and-dates.html#sec-numbertobigint">NumberToBigInt</a></emu-xref>(<var>prim</var>).</li><li>Return ?&nbsp;<emu-xref aoid="ToBigInt" id="_ref_10284"><a href="abstract-operations.html#sec-tobigint">ToBigInt</a></emu-xref>(<var>prim</var>).</li></ol></emu-alg>
<emu-clause id="sec-numbertobigint" type="abstract operation" aoid="NumberToBigInt">
<h1><span class="secnum">21.2.1.1.1</span> NumberToBigInt ( <var>number</var> )</h1>
<p>The abstract operation NumberToBigInt takes argument <var>number</var> (a Number) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_10285"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a BigInt or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_10286"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>number</var> is not an <emu-xref href="#integral-number" id="_ref_10287"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>, throw a <emu-val>RangeError</emu-val> exception.</li><li>Return <emu-xref aoid="" id="_ref_10288"><a href="notational-conventions.html#%E2%84%A4"></a></emu-xref>(<emu-xref aoid="" id="_ref_10289"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>number</var>)).</li></ol></emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-bigint-constructor">
<h1><span class="secnum">21.2.2</span> Properties of the BigInt Constructor</h1>
<p>The BigInt <emu-xref href="#constructor" id="_ref_10290"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-function-prototype-object" id="_ref_10291"><a href="fundamental-objects.html#sec-properties-of-the-function-prototype-object">%Function.prototype%</a></emu-xref>.</li>
<li>has the following properties:</li>
</ul>
<emu-clause id="sec-bigint.asintn" type="built-in function">
<h1><span class="secnum">21.2.2.1</span> BigInt.asIntN ( <var>bits</var>, <var>bigint</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Set <var>bits</var> to ?&nbsp;<emu-xref aoid="ToIndex" id="_ref_10292"><a href="abstract-operations.html#sec-toindex" class="e-user-code">ToIndex</a></emu-xref>(<var>bits</var>).</li><li>Set <var>bigint</var> to ?&nbsp;<emu-xref aoid="ToBigInt" id="_ref_10293"><a href="abstract-operations.html#sec-tobigint" class="e-user-code">ToBigInt</a></emu-xref>(<var>bigint</var>).</li><li>Let <var>mod</var> be <emu-xref aoid="" id="_ref_10294"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>bigint</var>) <emu-xref aoid="modulo" id="_ref_10295"><a href="notational-conventions.html#eqn-modulo">modulo</a></emu-xref> 2<sup><var>bits</var></sup>.</li><li>If <var>mod</var> ≥ 2<sup><var>bits</var> - 1</sup>, return <emu-xref aoid="" id="_ref_10296"><a href="notational-conventions.html#%E2%84%A4"></a></emu-xref>(<var>mod</var> - 2<sup><var>bits</var></sup>).</li><li>Return <emu-xref aoid="" id="_ref_10297"><a href="notational-conventions.html#%E2%84%A4"></a></emu-xref>(<var>mod</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-bigint.asuintn" type="built-in function">
<h1><span class="secnum">21.2.2.2</span> BigInt.asUintN ( <var>bits</var>, <var>bigint</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Set <var>bits</var> to ?&nbsp;<emu-xref aoid="ToIndex" id="_ref_10298"><a href="abstract-operations.html#sec-toindex" class="e-user-code">ToIndex</a></emu-xref>(<var>bits</var>).</li><li>Set <var>bigint</var> to ?&nbsp;<emu-xref aoid="ToBigInt" id="_ref_10299"><a href="abstract-operations.html#sec-tobigint" class="e-user-code">ToBigInt</a></emu-xref>(<var>bigint</var>).</li><li>Return <emu-xref aoid="" id="_ref_10300"><a href="notational-conventions.html#%E2%84%A4"></a></emu-xref>(<emu-xref aoid="" id="_ref_10301"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>bigint</var>) <emu-xref aoid="modulo" id="_ref_10302"><a href="notational-conventions.html#eqn-modulo">modulo</a></emu-xref> 2<sup><var>bits</var></sup>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-bigint.prototype">
<h1><span class="secnum">21.2.2.3</span> BigInt.prototype</h1>
<p>The initial value of <code>BigInt.prototype</code> is the <emu-xref href="#sec-properties-of-the-bigint-prototype-object" id="_ref_10303"><a href="numbers-and-dates.html#sec-properties-of-the-bigint-prototype-object">BigInt prototype object</a></emu-xref>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-bigint-prototype-object">
<h1><span class="secnum">21.2.3</span> Properties of the BigInt Prototype Object</h1>
<p>The <dfn tabindex="-1">BigInt prototype object</dfn>:</p>
<ul>
<li>is <dfn tabindex="-1">%BigInt.prototype%</dfn>.</li>
<li>is an <emu-xref href="#ordinary-object" id="_ref_10304"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref>.</li>
<li><emu-xref href="#sec-ecmascript-language-types-bigint-type" id="_ref_10305"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-bigint-type">is not a BigInt</a></emu-xref> object; it does not have a <var class="field">[[BigIntData]]</var> internal slot.</li>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-object-prototype-object" id="_ref_10306"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>.</li>
</ul>
<p>The phrase “this BigInt value” within the specification of a method refers to the result returned by calling the abstract operation <emu-xref aoid="ThisBigIntValue" id="_ref_10307"><a href="numbers-and-dates.html#sec-thisbigintvalue">ThisBigIntValue</a></emu-xref> with the <emu-val>this</emu-val> value of the method invocation passed as the argument.</p>
<emu-clause id="sec-bigint.prototype.constructor">
<h1><span class="secnum">21.2.3.1</span> BigInt.prototype.constructor</h1>
<p>The initial value of <code>BigInt.prototype.constructor</code> is <emu-xref href="#sec-bigint-constructor" id="_ref_10308"><a href="numbers-and-dates.html#sec-bigint-constructor">%BigInt%</a></emu-xref>.</p>
</emu-clause>
<emu-clause id="sec-bigint.prototype.tolocalestring" type="built-in function">
<h1><span class="secnum">21.2.3.2</span> BigInt.prototype.toLocaleString ( [ <var>reserved1</var> [ , <var>reserved2</var> ] ] )</h1>
<p>An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement this method as specified in the ECMA-402 specification. If an ECMAScript implementation does not include the ECMA-402 API the following specification of this method is used:</p>
<p>This method produces a String value that represents this BigInt value formatted according to the conventions of the <emu-xref href="#host-environment" id="_ref_10309"><a href="overview.html#host-environment">host environment</a></emu-xref>'s current locale. This method is <emu-xref href="#implementation-defined" id="_ref_10310"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref>, and it is permissible, but not encouraged, for it to return the same thing as <code>toString</code>.</p>
<p>The meanings of the optional parameters to this method are defined in the ECMA-402 specification; implementations that do not include ECMA-402 support must not use those parameter positions for anything else.</p>
</emu-clause>
<emu-clause id="sec-bigint.prototype.tostring" type="built-in function">
<h1><span class="secnum">21.2.3.3</span> BigInt.prototype.toString ( [ <var>radix</var> ] )</h1>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The optional <var>radix</var> should be an <emu-xref href="#integral-number" id="_ref_10311"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> value in the <emu-xref href="#inclusive-interval" id="_ref_10312"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from <emu-val>2</emu-val><sub>𝔽</sub> to <emu-val>36</emu-val><sub>𝔽</sub>. If <var>radix</var> is <emu-val>undefined</emu-val> then <emu-val>10</emu-val><sub>𝔽</sub> is used as the value of <var>radix</var>.</p>
</div></emu-note>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>x</var> be ?&nbsp;<emu-xref aoid="ThisBigIntValue" id="_ref_10313"><a href="numbers-and-dates.html#sec-thisbigintvalue">ThisBigIntValue</a></emu-xref>(<emu-val>this</emu-val> value).</li><li>If <var>radix</var> is <emu-val>undefined</emu-val>, let <var>radixMV</var> be 10.</li><li>Else, let <var>radixMV</var> be ?&nbsp;<emu-xref aoid="ToIntegerOrInfinity" id="_ref_10314"><a href="abstract-operations.html#sec-tointegerorinfinity" class="e-user-code">ToIntegerOrInfinity</a></emu-xref>(<var>radix</var>).</li><li>If <var>radixMV</var> is not in the <emu-xref href="#inclusive-interval" id="_ref_10315"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 2 to 36, throw a <emu-val>RangeError</emu-val> exception.</li><li>Return <emu-xref aoid="BigInt::toString" id="_ref_10316"><a href="ecmascript-data-types-and-values.html#sec-numeric-types-bigint-tostring">BigInt::toString</a></emu-xref>(<var>x</var>, <var>radixMV</var>).</li></ol></emu-alg>
<p>This method is not generic; it throws a <emu-val>TypeError</emu-val> exception if its <emu-val>this</emu-val> value <emu-xref href="#sec-ecmascript-language-types-bigint-type" id="_ref_10317"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-bigint-type">is not a BigInt</a></emu-xref> or a BigInt object. Therefore, it cannot be transferred to other kinds of objects for use as a method.</p>
</emu-clause>
<emu-clause id="sec-bigint.prototype.valueof" type="built-in function">
<h1><span class="secnum">21.2.3.4</span> BigInt.prototype.valueOf ( )</h1>
<emu-alg><ol><li>Return ?&nbsp;<emu-xref aoid="ThisBigIntValue" id="_ref_10318"><a href="numbers-and-dates.html#sec-thisbigintvalue">ThisBigIntValue</a></emu-xref>(<emu-val>this</emu-val> value).</li></ol></emu-alg>
<emu-clause id="sec-thisbigintvalue" type="abstract operation" oldids="thisbigintvalue" aoid="ThisBigIntValue"><span id="thisbigintvalue"></span>
<h1><span class="secnum">21.2.3.4.1</span> ThisBigIntValue ( <var>value</var> )</h1>
<p>The abstract operation ThisBigIntValue takes argument <var>value</var> (an <emu-xref href="#sec-ecmascript-language-types" id="_ref_10319"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types">ECMAScript language value</a></emu-xref>) and returns either a <emu-xref href="#sec-completion-record-specification-type" id="_ref_10320"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">normal completion containing</a></emu-xref> a BigInt or a <emu-xref href="#sec-completion-record-specification-type" id="_ref_10321"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">throw completion</a></emu-xref>. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>value</var> <emu-xref href="#sec-ecmascript-language-types-bigint-type" id="_ref_10322"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-bigint-type">is a BigInt</a></emu-xref>, return <var>value</var>.</li><li>If <var>value</var> <emu-xref href="#sec-object-type" id="_ref_10323"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref> and <var>value</var> has a <var class="field">[[BigIntData]]</var> internal slot, then<ol><li><emu-xref href="#assert" id="_ref_10324"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>value</var>.<var class="field">[[BigIntData]]</var> <emu-xref href="#sec-ecmascript-language-types-bigint-type" id="_ref_10325"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-bigint-type">is a BigInt</a></emu-xref>.</li><li>Return <var>value</var>.<var class="field">[[BigIntData]]</var>.</li></ol></li><li>Throw a <emu-val>TypeError</emu-val> exception.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause oldids="sec-bigint.prototype-@@tostringtag" id="sec-bigint.prototype-%symbol.tostringtag%"><span id="sec-bigint.prototype-@@tostringtag"></span>
<h1><span class="secnum">21.2.3.5</span> BigInt.prototype [ %Symbol.toStringTag% ]</h1>
<p>The initial value of the <emu-xref href="#sec-well-known-symbols" id="_ref_10326"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.toStringTag%</a></emu-xref> property is the String value <emu-val>"BigInt"</emu-val>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val> }.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-bigint-instances">
<h1><span class="secnum">21.2.4</span> Properties of BigInt Instances</h1>
<p>BigInt instances are <emu-xref href="#ordinary-object" id="_ref_10327"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref> that inherit properties from the <emu-xref href="#sec-properties-of-the-bigint-prototype-object" id="_ref_10328"><a href="numbers-and-dates.html#sec-properties-of-the-bigint-prototype-object">BigInt prototype object</a></emu-xref>. BigInt instances also have a <var class="field">[[BigIntData]]</var> internal slot. The <var class="field">[[BigIntData]]</var> internal slot is the BigInt value represented by this BigInt object.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-math-object">
<h1><span class="secnum">21.3</span> The Math Object</h1>
<p>The Math object:</p>
<ul>
<li>is <dfn tabindex="-1">%Math%</dfn>.</li>
<li>is the initial value of the <emu-val>"Math"</emu-val> property of the <emu-xref href="#sec-global-object" id="_ref_10329"><a href="global-object.html#sec-global-object">global object</a></emu-xref>.</li>
<li>is an <emu-xref href="#ordinary-object" id="_ref_10330"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref>.</li>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-object-prototype-object" id="_ref_10331"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>.</li>
<li>is not a <emu-xref href="#function-object" id="_ref_10332"><a href="ecmascript-data-types-and-values.html#function-object">function object</a></emu-xref>.</li>
<li>does not have a <var class="field">[[Construct]]</var> internal method; it cannot be used as a <emu-xref href="#constructor" id="_ref_10333"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> with the <code>new</code> operator.</li>
<li>does not have a <var class="field">[[Call]]</var> internal method; it cannot be invoked as a function.</li>
</ul>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>In this specification, the phrase “the <emu-xref href="#number-value-for" id="_ref_10334"><a href="ecmascript-data-types-and-values.html#number-value-for">Number value for</a></emu-xref> <var>x</var>” has a technical meaning defined in <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_638"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">6.1.6.1</a></emu-xref>.</p>
</div></emu-note>
<emu-clause id="sec-value-properties-of-the-math-object">
<h1><span class="secnum">21.3.1</span> Value Properties of the Math Object</h1>
<emu-clause id="sec-math.e">
<h1><span class="secnum">21.3.1.1</span> Math.E</h1>
<p>The <emu-xref href="#number-value-for" id="_ref_10335"><a href="ecmascript-data-types-and-values.html#number-value-for">Number value for</a></emu-xref> <i>e</i>, the base of the natural logarithms, which is approximately 2.7182818284590452354.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-math.ln10">
<h1><span class="secnum">21.3.1.2</span> Math.LN10</h1>
<p>The <emu-xref href="#number-value-for" id="_ref_10336"><a href="ecmascript-data-types-and-values.html#number-value-for">Number value for</a></emu-xref> the natural logarithm of 10, which is approximately 2.302585092994046.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-math.ln2">
<h1><span class="secnum">21.3.1.3</span> Math.LN2</h1>
<p>The <emu-xref href="#number-value-for" id="_ref_10337"><a href="ecmascript-data-types-and-values.html#number-value-for">Number value for</a></emu-xref> the natural logarithm of 2, which is approximately 0.6931471805599453.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-math.log10e">
<h1><span class="secnum">21.3.1.4</span> Math.LOG10E</h1>
<p>The <emu-xref href="#number-value-for" id="_ref_10338"><a href="ecmascript-data-types-and-values.html#number-value-for">Number value for</a></emu-xref> the base-10 logarithm of <i>e</i>, the base of the natural logarithms; this value is approximately 0.4342944819032518.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The value of <code>Math.LOG10E</code> is approximately the reciprocal of the value of <code>Math.LN10</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-math.log2e">
<h1><span class="secnum">21.3.1.5</span> Math.LOG2E</h1>
<p>The <emu-xref href="#number-value-for" id="_ref_10339"><a href="ecmascript-data-types-and-values.html#number-value-for">Number value for</a></emu-xref> the base-2 logarithm of <i>e</i>, the base of the natural logarithms; this value is approximately 1.4426950408889634.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The value of <code>Math.LOG2E</code> is approximately the reciprocal of the value of <code>Math.LN2</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-math.pi">
<h1><span class="secnum">21.3.1.6</span> Math.PI</h1>
<p>The <emu-xref href="#number-value-for" id="_ref_10340"><a href="ecmascript-data-types-and-values.html#number-value-for">Number value for</a></emu-xref> π, the ratio of the circumference of a circle to its diameter, which is approximately 3.1415926535897932.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-math.sqrt1_2">
<h1><span class="secnum">21.3.1.7</span> Math.SQRT1_2</h1>
<p>The <emu-xref href="#number-value-for" id="_ref_10341"><a href="ecmascript-data-types-and-values.html#number-value-for">Number value for</a></emu-xref> the square root of ½, which is approximately 0.7071067811865476.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The value of <code>Math.SQRT1_2</code> is approximately the reciprocal of the value of <code>Math.SQRT2</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-math.sqrt2">
<h1><span class="secnum">21.3.1.8</span> Math.SQRT2</h1>
<p>The <emu-xref href="#number-value-for" id="_ref_10342"><a href="ecmascript-data-types-and-values.html#number-value-for">Number value for</a></emu-xref> the square root of 2, which is approximately 1.4142135623730951.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause oldids="sec-math-@@tostringtag" id="sec-math-%symbol.tostringtag%"><span id="sec-math-@@tostringtag"></span>
<h1><span class="secnum">21.3.1.9</span> Math [ %Symbol.toStringTag% ]</h1>
<p>The initial value of the <emu-xref href="#sec-well-known-symbols" id="_ref_10343"><a href="ecmascript-data-types-and-values.html#sec-well-known-symbols">%Symbol.toStringTag%</a></emu-xref> property is the String value <emu-val>"Math"</emu-val>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val> }.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-function-properties-of-the-math-object">
<h1><span class="secnum">21.3.2</span> Function Properties of the Math Object</h1>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The behaviour of the functions <code>acos</code>, <code>acosh</code>, <code>asin</code>, <code>asinh</code>, <code>atan</code>, <code>atanh</code>, <code>atan2</code>, <code>cbrt</code>, <code>cos</code>, <code>cosh</code>, <code>exp</code>, <code>expm1</code>, <code>hypot</code>, <code>log</code>, <code>log1p</code>, <code>log2</code>, <code>log10</code>, <code>pow</code>, <code>random</code>, <code>sin</code>, <code>sinh</code>, <code>tan</code>, and <code>tanh</code> is not precisely specified here except to require specific results for certain argument values that represent boundary cases of interest. For other argument values, these functions are intended to compute approximations to the results of familiar mathematical functions, but some latitude is allowed in the choice of approximation algorithms. The general intent is that an implementer should be able to use the same mathematical library for ECMAScript on a given hardware platform that is available to C programmers on that platform.</p>
<p>Although the choice of algorithms is left to the implementation, it is recommended (but not specified by this standard) that implementations use the approximation algorithms for <emu-xref href="#sec-bibliography" id="_ref_10344"><a href="bibliography.html#sec-bibliography">IEEE 754-2019</a></emu-xref> arithmetic contained in <code>fdlibm</code>, the freely distributable mathematical library from Sun Microsystems (<a href="http://www.netlib.org/fdlibm">http://www.netlib.org/fdlibm</a>).</p>
</div></emu-note>
<emu-clause id="sec-math.abs" type="built-in function">
<h1><span class="secnum">21.3.2.1</span> Math.abs ( <var>x</var> )</h1>
<p>This function returns the absolute value of <var>x</var>; the result has the same magnitude as <var>x</var> but has positive sign.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10345"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>If <var>n</var> is <emu-val>-0</emu-val><sub>𝔽</sub>, return <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> is <emu-val>-∞</emu-val><sub>𝔽</sub>, return <emu-val>+∞</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> &lt; <emu-val>-0</emu-val><sub>𝔽</sub>, return -<var>n</var>.</li><li>Return <var>n</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.acos" type="built-in function">
<h1><span class="secnum">21.3.2.2</span> Math.acos ( <var>x</var> )</h1>
<p>This function returns the inverse cosine of <var>x</var>. The result is expressed in radians and is in the <emu-xref href="#inclusive-interval" id="_ref_10346"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from <emu-val>+0</emu-val><sub>𝔽</sub> to <emu-xref aoid="𝔽" id="_ref_10347"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(π).</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10348"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is <emu-val>NaN</emu-val>, <var>n</var> &gt; <emu-val>1</emu-val><sub>𝔽</sub>, or <var>n</var> &lt; <emu-val>-1</emu-val><sub>𝔽</sub>, return <emu-val>NaN</emu-val>.</li><li>If <var>n</var> is <emu-val>1</emu-val><sub>𝔽</sub>, return <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10349"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing the inverse cosine of <emu-xref aoid="" id="_ref_10350"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.acosh" type="built-in function">
<h1><span class="secnum">21.3.2.3</span> Math.acosh ( <var>x</var> )</h1>
<p>This function returns the inverse hyperbolic cosine of <var>x</var>.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10351"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is either <emu-val>NaN</emu-val> or <emu-val>+∞</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> is <emu-val>1</emu-val><sub>𝔽</sub>, return <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> &lt; <emu-val>1</emu-val><sub>𝔽</sub>, return <emu-val>NaN</emu-val>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10352"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing the inverse hyperbolic cosine of <emu-xref aoid="" id="_ref_10353"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.asin" type="built-in function">
<h1><span class="secnum">21.3.2.4</span> Math.asin ( <var>x</var> )</h1>
<p>This function returns the inverse sine of <var>x</var>. The result is expressed in radians and is in the <emu-xref href="#inclusive-interval" id="_ref_10354"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from <emu-xref aoid="𝔽" id="_ref_10355"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(-π / 2) to <emu-xref aoid="𝔽" id="_ref_10356"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(π / 2).</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10357"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is one of <emu-val>NaN</emu-val>, <emu-val>+0</emu-val><sub>𝔽</sub>, or <emu-val>-0</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> &gt; <emu-val>1</emu-val><sub>𝔽</sub> or <var>n</var> &lt; <emu-val>-1</emu-val><sub>𝔽</sub>, return <emu-val>NaN</emu-val>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10358"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing the inverse sine of <emu-xref aoid="" id="_ref_10359"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.asinh" type="built-in function">
<h1><span class="secnum">21.3.2.5</span> Math.asinh ( <var>x</var> )</h1>
<p>This function returns the inverse hyperbolic sine of <var>x</var>.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10360"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is not <emu-xref href="#finite" id="_ref_10361"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> or <var>n</var> is either <emu-val>+0</emu-val><sub>𝔽</sub> or <emu-val>-0</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10362"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing the inverse hyperbolic sine of <emu-xref aoid="" id="_ref_10363"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.atan" type="built-in function">
<h1><span class="secnum">21.3.2.6</span> Math.atan ( <var>x</var> )</h1>
<p>This function returns the inverse tangent of <var>x</var>. The result is expressed in radians and is in the <emu-xref href="#inclusive-interval" id="_ref_10364"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from <emu-xref aoid="𝔽" id="_ref_10365"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(-π / 2) to <emu-xref aoid="𝔽" id="_ref_10366"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(π / 2).</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10367"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is one of <emu-val>NaN</emu-val>, <emu-val>+0</emu-val><sub>𝔽</sub>, or <emu-val>-0</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> is <emu-val>+∞</emu-val><sub>𝔽</sub>, return an <emu-xref href="#implementation-approximated" id="_ref_10368"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing π / 2.</li><li>If <var>n</var> is <emu-val>-∞</emu-val><sub>𝔽</sub>, return an <emu-xref href="#implementation-approximated" id="_ref_10369"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing -π / 2.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10370"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing the inverse tangent of <emu-xref aoid="" id="_ref_10371"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.atanh" type="built-in function">
<h1><span class="secnum">21.3.2.7</span> Math.atanh ( <var>x</var> )</h1>
<p>This function returns the inverse hyperbolic tangent of <var>x</var>.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10372"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is one of <emu-val>NaN</emu-val>, <emu-val>+0</emu-val><sub>𝔽</sub>, or <emu-val>-0</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> &gt; <emu-val>1</emu-val><sub>𝔽</sub> or <var>n</var> &lt; <emu-val>-1</emu-val><sub>𝔽</sub>, return <emu-val>NaN</emu-val>.</li><li>If <var>n</var> is <emu-val>1</emu-val><sub>𝔽</sub>, return <emu-val>+∞</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> is <emu-val>-1</emu-val><sub>𝔽</sub>, return <emu-val>-∞</emu-val><sub>𝔽</sub>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10373"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing the inverse hyperbolic tangent of <emu-xref aoid="" id="_ref_10374"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.atan2" type="built-in function">
<h1><span class="secnum">21.3.2.8</span> Math.atan2 ( <var>y</var>, <var>x</var> )</h1>
<p>This function returns the inverse tangent of the quotient <emu-eqn class="inline"><var>y</var> / <var>x</var></emu-eqn> of the arguments <var>y</var> and <var>x</var>, where the signs of <var>y</var> and <var>x</var> are used to determine the quadrant of the result. Note that it is intentional and traditional for the two-argument inverse tangent function that the argument named <var>y</var> be first and the argument named <var>x</var> be second. The result is expressed in radians and is in the <emu-xref href="#inclusive-interval" id="_ref_10375"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from -π to +π.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>ny</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10376"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>y</var>).</li><li>Let <var>nx</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10377"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>ny</var> is <emu-val>NaN</emu-val> or <var>nx</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>If <var>ny</var> is <emu-val>+∞</emu-val><sub>𝔽</sub>, then<ol><li>If <var>nx</var> is <emu-val>+∞</emu-val><sub>𝔽</sub>, return an <emu-xref href="#implementation-approximated" id="_ref_10378"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing π / 4.</li><li>If <var>nx</var> is <emu-val>-∞</emu-val><sub>𝔽</sub>, return an <emu-xref href="#implementation-approximated" id="_ref_10379"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing 3π / 4.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10380"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing π / 2.</li></ol></li><li>If <var>ny</var> is <emu-val>-∞</emu-val><sub>𝔽</sub>, then<ol><li>If <var>nx</var> is <emu-val>+∞</emu-val><sub>𝔽</sub>, return an <emu-xref href="#implementation-approximated" id="_ref_10381"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing -π / 4.</li><li>If <var>nx</var> is <emu-val>-∞</emu-val><sub>𝔽</sub>, return an <emu-xref href="#implementation-approximated" id="_ref_10382"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing -3π / 4.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10383"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing -π / 2.</li></ol></li><li>If <var>ny</var> is <emu-val>+0</emu-val><sub>𝔽</sub>, then<ol><li>If <var>nx</var> &gt; <emu-val>+0</emu-val><sub>𝔽</sub> or <var>nx</var> is <emu-val>+0</emu-val><sub>𝔽</sub>, return <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10384"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing π.</li></ol></li><li>If <var>ny</var> is <emu-val>-0</emu-val><sub>𝔽</sub>, then<ol><li>If <var>nx</var> &gt; <emu-val>+0</emu-val><sub>𝔽</sub> or <var>nx</var> is <emu-val>+0</emu-val><sub>𝔽</sub>, return <emu-val>-0</emu-val><sub>𝔽</sub>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10385"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing -π.</li></ol></li><li><emu-xref href="#assert" id="_ref_10386"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>ny</var> is <emu-xref href="#finite" id="_ref_10387"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> and is neither <emu-val>+0</emu-val><sub>𝔽</sub> nor <emu-val>-0</emu-val><sub>𝔽</sub>.</li><li>If <var>ny</var> &gt; <emu-val>+0</emu-val><sub>𝔽</sub>, then<ol><li>If <var>nx</var> is <emu-val>+∞</emu-val><sub>𝔽</sub>, return <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>nx</var> is <emu-val>-∞</emu-val><sub>𝔽</sub>, return an <emu-xref href="#implementation-approximated" id="_ref_10388"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing π.</li><li>If <var>nx</var> is either <emu-val>+0</emu-val><sub>𝔽</sub> or <emu-val>-0</emu-val><sub>𝔽</sub>, return an <emu-xref href="#implementation-approximated" id="_ref_10389"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing π / 2.</li></ol></li><li>If <var>ny</var> &lt; <emu-val>-0</emu-val><sub>𝔽</sub>, then<ol><li>If <var>nx</var> is <emu-val>+∞</emu-val><sub>𝔽</sub>, return <emu-val>-0</emu-val><sub>𝔽</sub>.</li><li>If <var>nx</var> is <emu-val>-∞</emu-val><sub>𝔽</sub>, return an <emu-xref href="#implementation-approximated" id="_ref_10390"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing -π.</li><li>If <var>nx</var> is either <emu-val>+0</emu-val><sub>𝔽</sub> or <emu-val>-0</emu-val><sub>𝔽</sub>, return an <emu-xref href="#implementation-approximated" id="_ref_10391"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing -π / 2.</li></ol></li><li><emu-xref href="#assert" id="_ref_10392"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>nx</var> is <emu-xref href="#finite" id="_ref_10393"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> and is neither <emu-val>+0</emu-val><sub>𝔽</sub> nor <emu-val>-0</emu-val><sub>𝔽</sub>.</li><li>Let <var>r</var> be the inverse tangent of <emu-xref aoid="abs" id="_ref_10394"><a href="notational-conventions.html#eqn-abs">abs</a></emu-xref>(<emu-xref aoid="" id="_ref_10395"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>ny</var>) / <emu-xref aoid="" id="_ref_10396"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>nx</var>)).</li><li>If <var>nx</var> &lt; <emu-val>-0</emu-val><sub>𝔽</sub>, then<ol><li>If <var>ny</var> &gt; <emu-val>+0</emu-val><sub>𝔽</sub>, set <var>r</var> to π - <var>r</var>.</li><li>Else, set <var>r</var> to -π + <var>r</var>.</li></ol></li><li>Else,<ol><li>If <var>ny</var> &lt; <emu-val>-0</emu-val><sub>𝔽</sub>, set <var>r</var> to -<var>r</var>.</li></ol></li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10397"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing <var>r</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.cbrt" type="built-in function">
<h1><span class="secnum">21.3.2.9</span> Math.cbrt ( <var>x</var> )</h1>
<p>This function returns the cube root of <var>x</var>.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10398"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is not <emu-xref href="#finite" id="_ref_10399"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> or <var>n</var> is either <emu-val>+0</emu-val><sub>𝔽</sub> or <emu-val>-0</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10400"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing the cube root of <emu-xref aoid="" id="_ref_10401"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.ceil" type="built-in function">
<h1><span class="secnum">21.3.2.10</span> Math.ceil ( <var>x</var> )</h1>
<p>This function returns the smallest (closest to -∞) <emu-xref href="#integral-number" id="_ref_10402"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> value that is not less than <var>x</var>. If <var>x</var> is already an <emu-xref href="#integral-number" id="_ref_10403"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>, the result is <var>x</var>.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10404"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is not <emu-xref href="#finite" id="_ref_10405"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> or <var>n</var> is either <emu-val>+0</emu-val><sub>𝔽</sub> or <emu-val>-0</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> &lt; <emu-val>-0</emu-val><sub>𝔽</sub> and <var>n</var> &gt; <emu-val>-1</emu-val><sub>𝔽</sub>, return <emu-val>-0</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> is an <emu-xref href="#integral-number" id="_ref_10406"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>, return <var>n</var>.</li><li>Return the smallest (closest to -∞) <emu-xref href="#integral-number" id="_ref_10407"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> value that is not less than <var>n</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The value of <code>Math.ceil(x)</code> is the same as the value of <code>-Math.floor(-x)</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-math.clz32" type="built-in function">
<h1><span class="secnum">21.3.2.11</span> Math.clz32 ( <var>x</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToUint32" id="_ref_10408"><a href="abstract-operations.html#sec-touint32" class="e-user-code">ToUint32</a></emu-xref>(<var>x</var>).</li><li>Let <var>p</var> be the number of leading zero bits in the unsigned 32-bit binary representation of <var>n</var>.</li><li>Return <emu-xref aoid="𝔽" id="_ref_10409"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>p</var>).</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>If <var>n</var> is either <emu-val>+0</emu-val><sub>𝔽</sub> or <emu-val>-0</emu-val><sub>𝔽</sub>, this method returns <emu-val>32</emu-val><sub>𝔽</sub>. If the most significant bit of the 32-bit binary encoding of <var>n</var> is 1, this method returns <emu-val>+0</emu-val><sub>𝔽</sub>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-math.cos" type="built-in function">
<h1><span class="secnum">21.3.2.12</span> Math.cos ( <var>x</var> )</h1>
<p>This function returns the cosine of <var>x</var>. The argument is expressed in radians.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10410"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is not <emu-xref href="#finite" id="_ref_10411"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, return <emu-val>NaN</emu-val>.</li><li>If <var>n</var> is either <emu-val>+0</emu-val><sub>𝔽</sub> or <emu-val>-0</emu-val><sub>𝔽</sub>, return <emu-val>1</emu-val><sub>𝔽</sub>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10412"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing the cosine of <emu-xref aoid="" id="_ref_10413"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.cosh" type="built-in function">
<h1><span class="secnum">21.3.2.13</span> Math.cosh ( <var>x</var> )</h1>
<p>This function returns the hyperbolic cosine of <var>x</var>.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10414"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>If <var>n</var> is either <emu-val>+∞</emu-val><sub>𝔽</sub> or <emu-val>-∞</emu-val><sub>𝔽</sub>, return <emu-val>+∞</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> is either <emu-val>+0</emu-val><sub>𝔽</sub> or <emu-val>-0</emu-val><sub>𝔽</sub>, return <emu-val>1</emu-val><sub>𝔽</sub>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10415"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing the hyperbolic cosine of <emu-xref aoid="" id="_ref_10416"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>).</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The value of <code>Math.cosh(x)</code> is the same as the value of <code>(Math.exp(x) + Math.exp(-x)) / 2</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-math.exp" type="built-in function">
<h1><span class="secnum">21.3.2.14</span> Math.exp ( <var>x</var> )</h1>
<p>This function returns the exponential function of <var>x</var> (<var>e</var> raised to the power of <var>x</var>, where <var>e</var> is the base of the natural logarithms).</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10417"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is either <emu-val>NaN</emu-val> or <emu-val>+∞</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> is either <emu-val>+0</emu-val><sub>𝔽</sub> or <emu-val>-0</emu-val><sub>𝔽</sub>, return <emu-val>1</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> is <emu-val>-∞</emu-val><sub>𝔽</sub>, return <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10418"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing the exponential function of <emu-xref aoid="" id="_ref_10419"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.expm1" type="built-in function">
<h1><span class="secnum">21.3.2.15</span> Math.expm1 ( <var>x</var> )</h1>
<p>This function returns the result of subtracting 1 from the exponential function of <var>x</var> (<var>e</var> raised to the power of <var>x</var>, where <var>e</var> is the base of the natural logarithms). The result is computed in a way that is accurate even when the value of <var>x</var> is close to 0.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10420"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is one of <emu-val>NaN</emu-val>, <emu-val>+0</emu-val><sub>𝔽</sub>, <emu-val>-0</emu-val><sub>𝔽</sub>, or <emu-val>+∞</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> is <emu-val>-∞</emu-val><sub>𝔽</sub>, return <emu-val>-1</emu-val><sub>𝔽</sub>.</li><li>Let <var>exp</var> be the exponential function of <emu-xref aoid="" id="_ref_10421"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>).</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10422"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing <var>exp</var> - 1.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.floor" type="built-in function">
<h1><span class="secnum">21.3.2.16</span> Math.floor ( <var>x</var> )</h1>
<p>This function returns the greatest (closest to +∞) <emu-xref href="#integral-number" id="_ref_10423"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> value that is not greater than <var>x</var>. If <var>x</var> is already an <emu-xref href="#integral-number" id="_ref_10424"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>, the result is <var>x</var>.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10425"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is not <emu-xref href="#finite" id="_ref_10426"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> or <var>n</var> is either <emu-val>+0</emu-val><sub>𝔽</sub> or <emu-val>-0</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> &lt; <emu-val>1</emu-val><sub>𝔽</sub> and <var>n</var> &gt; <emu-val>+0</emu-val><sub>𝔽</sub>, return <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> is an <emu-xref href="#integral-number" id="_ref_10427"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>, return <var>n</var>.</li><li>Return the greatest (closest to +∞) <emu-xref href="#integral-number" id="_ref_10428"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> value that is not greater than <var>n</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The value of <code>Math.floor(x)</code> is the same as the value of <code>-Math.ceil(-x)</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-math.fround" type="built-in function">
<h1><span class="secnum">21.3.2.17</span> Math.fround ( <var>x</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10429"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>If <var>n</var> is one of <emu-val>+0</emu-val><sub>𝔽</sub>, <emu-val>-0</emu-val><sub>𝔽</sub>, <emu-val>+∞</emu-val><sub>𝔽</sub>, or <emu-val>-∞</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>Let <var>n32</var> be the result of converting <var>n</var> to <emu-xref href="#sec-bibliography" id="_ref_10430"><a href="bibliography.html#sec-bibliography">IEEE 754-2019</a></emu-xref> binary32 format using roundTiesToEven mode.</li><li>Let <var>n64</var> be the result of converting <var>n32</var> to <emu-xref href="#sec-bibliography" id="_ref_10431"><a href="bibliography.html#sec-bibliography">IEEE 754-2019</a></emu-xref> binary64 format.</li><li>Return the ECMAScript Number value corresponding to <var>n64</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.f16round" type="built-in function">
<h1><span class="secnum">21.3.2.18</span> Math.f16round ( <var>x</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10432"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>If <var>n</var> is one of <emu-val>+0</emu-val><sub>𝔽</sub>, <emu-val>-0</emu-val><sub>𝔽</sub>, <emu-val>+∞</emu-val><sub>𝔽</sub>, or <emu-val>-∞</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>Let <var>n16</var> be the result of converting <var>n</var> to <emu-xref href="#sec-bibliography" id="_ref_10433"><a href="bibliography.html#sec-bibliography">IEEE 754-2019</a></emu-xref> binary16 format using roundTiesToEven mode.</li><li>Let <var>n64</var> be the result of converting <var>n16</var> to <emu-xref href="#sec-bibliography" id="_ref_10434"><a href="bibliography.html#sec-bibliography">IEEE 754-2019</a></emu-xref> binary64 format.</li><li>Return the ECMAScript Number value corresponding to <var>n64</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>This operation is not the same as casting to binary32 and then to binary16 because of the possibility of double-rounding: consider the number <var>k</var> = <emu-val>1.00048828125000022204</emu-val><sub>𝔽</sub>, for example, for which Math.f16round(<var>k</var>) is <emu-val>1.0009765625</emu-val><sub>𝔽</sub>, but Math.f16round(Math.fround(<var>k</var>)) is <emu-val>1</emu-val><sub>𝔽</sub>.</p>
<p>Not all platforms provide native support for casting from binary64 to binary16. There are various libraries which can provide this, including the MIT-licensed <a href="https://half.sourceforge.net/">half</a> library. Alternatively, it is possible to first cast from binary64 to binary32 under roundTiesToEven and then check whether the result could lead to incorrect double-rounding. Such cases can be handled explicitly by adjusting the mantissa of the binary32 value so that it is the value which would be produced by performing the initial cast under roundTiesToOdd. Casting the adjusted value to binary16 under roundTiesToEven then produces the correct value.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-math.hypot" type="built-in function">
<h1><span class="secnum">21.3.2.19</span> Math.hypot ( ...<var>args</var> )</h1>
<p>Given zero or more arguments, this function returns the square root of the sum of squares of its arguments.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>coerced</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10435"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>For each element <var>arg</var> of <var>args</var>, do<ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10436"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>arg</var>).</li><li>Append <var>n</var> to <var>coerced</var>.</li></ol></li><li>For each element <var>number</var> of <var>coerced</var>, do<ol><li>If <var>number</var> is either <emu-val>+∞</emu-val><sub>𝔽</sub> or <emu-val>-∞</emu-val><sub>𝔽</sub>, return <emu-val>+∞</emu-val><sub>𝔽</sub>.</li></ol></li><li>Let <var>onlyZero</var> be <emu-val>true</emu-val>.</li><li>For each element <var>number</var> of <var>coerced</var>, do<ol><li>If <var>number</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>If <var>number</var> is neither <emu-val>+0</emu-val><sub>𝔽</sub> nor <emu-val>-0</emu-val><sub>𝔽</sub>, set <var>onlyZero</var> to <emu-val>false</emu-val>.</li></ol></li><li>If <var>onlyZero</var> is <emu-val>true</emu-val>, return <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10437"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing the square root of the sum of squares of the <emu-xref href="#mathematical-value" id="_ref_10438"><a href="notational-conventions.html#mathematical-value">mathematical values</a></emu-xref> of the elements of <var>coerced</var>.</li></ol></emu-alg>
<p>The <emu-val>"length"</emu-val> property of this function is <emu-val>2</emu-val><sub>𝔽</sub>.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>Implementations should take care to avoid the loss of precision from overflows and underflows that are prone to occur in naive implementations when this function is called with two or more arguments.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-math.imul" type="built-in function">
<h1><span class="secnum">21.3.2.20</span> Math.imul ( <var>x</var>, <var>y</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>a</var> be <emu-xref aoid="" id="_ref_10439"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(? <emu-xref aoid="ToUint32" id="_ref_10440"><a href="abstract-operations.html#sec-touint32" class="e-user-code">ToUint32</a></emu-xref>(<var>x</var>)).</li><li>Let <var>b</var> be <emu-xref aoid="" id="_ref_10441"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(? <emu-xref aoid="ToUint32" id="_ref_10442"><a href="abstract-operations.html#sec-touint32" class="e-user-code">ToUint32</a></emu-xref>(<var>y</var>)).</li><li>Let <var>product</var> be (<var>a</var> × <var>b</var>) <emu-xref aoid="modulo" id="_ref_10443"><a href="notational-conventions.html#eqn-modulo">modulo</a></emu-xref> 2<sup>32</sup>.</li><li>If <var>product</var> ≥ 2<sup>31</sup>, return <emu-xref aoid="𝔽" id="_ref_10444"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>product</var> - 2<sup>32</sup>).</li><li>Return <emu-xref aoid="𝔽" id="_ref_10445"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>product</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.log" type="built-in function">
<h1><span class="secnum">21.3.2.21</span> Math.log ( <var>x</var> )</h1>
<p>This function returns the natural logarithm of <var>x</var>.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10446"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is either <emu-val>NaN</emu-val> or <emu-val>+∞</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> is <emu-val>1</emu-val><sub>𝔽</sub>, return <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> is either <emu-val>+0</emu-val><sub>𝔽</sub> or <emu-val>-0</emu-val><sub>𝔽</sub>, return <emu-val>-∞</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> &lt; <emu-val>-0</emu-val><sub>𝔽</sub>, return <emu-val>NaN</emu-val>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10447"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing <emu-xref aoid="ln" id="_ref_10448"><a href="notational-conventions.html#eqn-ln">ln</a></emu-xref>(<emu-xref aoid="" id="_ref_10449"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.log1p" type="built-in function">
<h1><span class="secnum">21.3.2.22</span> Math.log1p ( <var>x</var> )</h1>
<p>This function returns the natural logarithm of 1 + <var>x</var>. The result is computed in a way that is accurate even when the value of x is close to zero.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10450"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is one of <emu-val>NaN</emu-val>, <emu-val>+0</emu-val><sub>𝔽</sub>, <emu-val>-0</emu-val><sub>𝔽</sub>, or <emu-val>+∞</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> is <emu-val>-1</emu-val><sub>𝔽</sub>, return <emu-val>-∞</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> &lt; <emu-val>-1</emu-val><sub>𝔽</sub>, return <emu-val>NaN</emu-val>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10451"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing <emu-xref aoid="ln" id="_ref_10452"><a href="notational-conventions.html#eqn-ln">ln</a></emu-xref>(1 + <emu-xref aoid="" id="_ref_10453"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.log10" type="built-in function">
<h1><span class="secnum">21.3.2.23</span> Math.log10 ( <var>x</var> )</h1>
<p>This function returns the base 10 logarithm of <var>x</var>.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10454"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is either <emu-val>NaN</emu-val> or <emu-val>+∞</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> is <emu-val>1</emu-val><sub>𝔽</sub>, return <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> is either <emu-val>+0</emu-val><sub>𝔽</sub> or <emu-val>-0</emu-val><sub>𝔽</sub>, return <emu-val>-∞</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> &lt; <emu-val>-0</emu-val><sub>𝔽</sub>, return <emu-val>NaN</emu-val>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10455"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing <emu-xref aoid="log10" id="_ref_10456"><a href="notational-conventions.html#eqn-log10">log10</a></emu-xref>(<emu-xref aoid="" id="_ref_10457"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.log2" type="built-in function">
<h1><span class="secnum">21.3.2.24</span> Math.log2 ( <var>x</var> )</h1>
<p>This function returns the base 2 logarithm of <var>x</var>.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10458"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is either <emu-val>NaN</emu-val> or <emu-val>+∞</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> is <emu-val>1</emu-val><sub>𝔽</sub>, return <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> is either <emu-val>+0</emu-val><sub>𝔽</sub> or <emu-val>-0</emu-val><sub>𝔽</sub>, return <emu-val>-∞</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> &lt; <emu-val>-0</emu-val><sub>𝔽</sub>, return <emu-val>NaN</emu-val>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10459"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing <emu-xref aoid="log2" id="_ref_10460"><a href="notational-conventions.html#eqn-log2">log2</a></emu-xref>(<emu-xref aoid="" id="_ref_10461"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.max" type="built-in function">
<h1><span class="secnum">21.3.2.25</span> Math.max ( ...<var>args</var> )</h1>
<p>Given zero or more arguments, this function calls <emu-xref aoid="ToNumber" id="_ref_10462"><a href="abstract-operations.html#sec-tonumber">ToNumber</a></emu-xref> on each of the arguments and returns the largest of the resulting values.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>coerced</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10463"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>For each element <var>arg</var> of <var>args</var>, do<ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10464"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>arg</var>).</li><li>Append <var>n</var> to <var>coerced</var>.</li></ol></li><li>Let <var>highest</var> be <emu-val>-∞</emu-val><sub>𝔽</sub>.</li><li>For each element <var>number</var> of <var>coerced</var>, do<ol><li>If <var>number</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>If <var>number</var> is <emu-val>+0</emu-val><sub>𝔽</sub> and <var>highest</var> is <emu-val>-0</emu-val><sub>𝔽</sub>, set <var>highest</var> to <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>number</var> &gt; <var>highest</var>, set <var>highest</var> to <var>number</var>.</li></ol></li><li>Return <var>highest</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The comparison of values to determine the largest value is done using the <emu-xref aoid="IsLessThan" id="_ref_10465"><a href="abstract-operations.html#sec-islessthan">IsLessThan</a></emu-xref> algorithm except that <emu-val>+0</emu-val><sub>𝔽</sub> is considered to be larger than <emu-val>-0</emu-val><sub>𝔽</sub>.</p>
</div></emu-note>
<p>The <emu-val>"length"</emu-val> property of this function is <emu-val>2</emu-val><sub>𝔽</sub>.</p>
</emu-clause>
<emu-clause id="sec-math.min" type="built-in function">
<h1><span class="secnum">21.3.2.26</span> Math.min ( ...<var>args</var> )</h1>
<p>Given zero or more arguments, this function calls <emu-xref aoid="ToNumber" id="_ref_10466"><a href="abstract-operations.html#sec-tonumber">ToNumber</a></emu-xref> on each of the arguments and returns the smallest of the resulting values.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>coerced</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10467"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>For each element <var>arg</var> of <var>args</var>, do<ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10468"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>arg</var>).</li><li>Append <var>n</var> to <var>coerced</var>.</li></ol></li><li>Let <var>lowest</var> be <emu-val>+∞</emu-val><sub>𝔽</sub>.</li><li>For each element <var>number</var> of <var>coerced</var>, do<ol><li>If <var>number</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>If <var>number</var> is <emu-val>-0</emu-val><sub>𝔽</sub> and <var>lowest</var> is <emu-val>+0</emu-val><sub>𝔽</sub>, set <var>lowest</var> to <emu-val>-0</emu-val><sub>𝔽</sub>.</li><li>If <var>number</var> &lt; <var>lowest</var>, set <var>lowest</var> to <var>number</var>.</li></ol></li><li>Return <var>lowest</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The comparison of values to determine the largest value is done using the <emu-xref aoid="IsLessThan" id="_ref_10469"><a href="abstract-operations.html#sec-islessthan">IsLessThan</a></emu-xref> algorithm except that <emu-val>+0</emu-val><sub>𝔽</sub> is considered to be larger than <emu-val>-0</emu-val><sub>𝔽</sub>.</p>
</div></emu-note>
<p>The <emu-val>"length"</emu-val> property of this function is <emu-val>2</emu-val><sub>𝔽</sub>.</p>
</emu-clause>
<emu-clause id="sec-math.pow" type="built-in function">
<h1><span class="secnum">21.3.2.27</span> Math.pow ( <var>base</var>, <var>exponent</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Set <var>base</var> to ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10470"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>base</var>).</li><li>Set <var>exponent</var> to ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10471"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>exponent</var>).</li><li>Return <emu-xref aoid="Number::exponentiate" id="_ref_10472"><a href="ecmascript-data-types-and-values.html#sec-numeric-types-number-exponentiate">Number::exponentiate</a></emu-xref>(<var>base</var>, <var>exponent</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.random" type="built-in function">
<h1><span class="secnum">21.3.2.28</span> Math.random ( )</h1>
<p>This function returns a Number value with positive sign, greater than or equal to <emu-val>+0</emu-val><sub>𝔽</sub> but strictly less than <emu-val>1</emu-val><sub>𝔽</sub>, chosen randomly or pseudo randomly with approximately uniform distribution over that range, using an <emu-xref href="#implementation-defined" id="_ref_10473"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> algorithm or strategy.</p>
<p>Each <code>Math.random</code> function created for distinct <emu-xref href="#realm" id="_ref_10474"><a href="executable-code-and-execution-contexts.html#realm">realms</a></emu-xref> must produce a distinct sequence of values from successive calls.</p>
</emu-clause>
<emu-clause id="sec-math.round" type="built-in function">
<h1><span class="secnum">21.3.2.29</span> Math.round ( <var>x</var> )</h1>
<p>This function returns the Number value that is closest to <var>x</var> and is integral. If two <emu-xref href="#integral-number" id="_ref_10475"><a href="notational-conventions.html#integral-number">integral Numbers</a></emu-xref> are equally close to <var>x</var>, then the result is the Number value that is closer to +∞. If <var>x</var> is already integral, the result is <var>x</var>.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10476"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is not <emu-xref href="#finite" id="_ref_10477"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> or <var>n</var> is an <emu-xref href="#integral-number" id="_ref_10478"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>, return <var>n</var>.</li><li>If <var>n</var> &lt; <emu-val>0.5</emu-val><sub>𝔽</sub> and <var>n</var> &gt; <emu-val>+0</emu-val><sub>𝔽</sub>, return <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> &lt; <emu-val>-0</emu-val><sub>𝔽</sub> and <var>n</var><emu-val>-0.5</emu-val><sub>𝔽</sub>, return <emu-val>-0</emu-val><sub>𝔽</sub>.</li><li>Return the <emu-xref href="#integral-number" id="_ref_10479"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> closest to <var>n</var>, preferring the Number closer to +∞ in the case of a tie.</li></ol></emu-alg>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p><code>Math.round(3.5)</code> returns 4, but <code>Math.round(-3.5)</code> returns -3.</p>
</div></emu-note>
<emu-note><span class="note">Note 2</span><div class="note-contents">
<p>The value of <code>Math.round(x)</code> is not always the same as the value of <code>Math.floor(x + 0.5)</code>. When <code>x</code> is <emu-val>-0</emu-val><sub>𝔽</sub> or <code>x</code> is less than <emu-val>-0</emu-val><sub>𝔽</sub> but greater than or equal to <emu-val>-0.5</emu-val><sub>𝔽</sub>, <code>Math.round(x)</code> returns <emu-val>-0</emu-val><sub>𝔽</sub>, but <code>Math.floor(x + 0.5)</code> returns <emu-val>+0</emu-val><sub>𝔽</sub>. <code>Math.round(x)</code> may also differ from the value of <code>Math.floor(x + 0.5)</code>because of internal rounding when computing <code>x + 0.5</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-math.sign" type="built-in function">
<h1><span class="secnum">21.3.2.30</span> Math.sign ( <var>x</var> )</h1>
<p>This function returns the sign of <var>x</var>, indicating whether <var>x</var> is positive, negative, or zero.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10480"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is one of <emu-val>NaN</emu-val>, <emu-val>+0</emu-val><sub>𝔽</sub>, or <emu-val>-0</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> &lt; <emu-val>-0</emu-val><sub>𝔽</sub>, return <emu-val>-1</emu-val><sub>𝔽</sub>.</li><li>Return <emu-val>1</emu-val><sub>𝔽</sub>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.sin" type="built-in function">
<h1><span class="secnum">21.3.2.31</span> Math.sin ( <var>x</var> )</h1>
<p>This function returns the sine of <var>x</var>. The argument is expressed in radians.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10481"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is one of <emu-val>NaN</emu-val>, <emu-val>+0</emu-val><sub>𝔽</sub>, or <emu-val>-0</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> is either <emu-val>+∞</emu-val><sub>𝔽</sub> or <emu-val>-∞</emu-val><sub>𝔽</sub>, return <emu-val>NaN</emu-val>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10482"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing the sine of <emu-xref aoid="" id="_ref_10483"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.sinh" type="built-in function">
<h1><span class="secnum">21.3.2.32</span> Math.sinh ( <var>x</var> )</h1>
<p>This function returns the hyperbolic sine of <var>x</var>.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10484"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is not <emu-xref href="#finite" id="_ref_10485"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> or <var>n</var> is either <emu-val>+0</emu-val><sub>𝔽</sub> or <emu-val>-0</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10486"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing the hyperbolic sine of <emu-xref aoid="" id="_ref_10487"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>).</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The value of <code>Math.sinh(x)</code> is the same as the value of <code>(Math.exp(x) - Math.exp(-x)) / 2</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-math.sqrt" type="built-in function">
<h1><span class="secnum">21.3.2.33</span> Math.sqrt ( <var>x</var> )</h1>
<p>This function returns the square root of <var>x</var>.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10488"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is one of <emu-val>NaN</emu-val>, <emu-val>+0</emu-val><sub>𝔽</sub>, <emu-val>-0</emu-val><sub>𝔽</sub>, or <emu-val>+∞</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> &lt; <emu-val>-0</emu-val><sub>𝔽</sub>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="𝔽" id="_ref_10489"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(the square root of <emu-xref aoid="" id="_ref_10490"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.sumprecise" type="built-in function">
<h1><span class="secnum">21.3.2.34</span> Math.sumPrecise ( <var>items</var> )</h1>
<p>Given an <emu-xref href="#sec-iterable-interface" id="_ref_10491"><a href="control-abstraction-objects.html#sec-iterable-interface">iterable</a></emu-xref> of Numbers, this function sums each value in the <emu-xref href="#sec-iterable-interface" id="_ref_10492"><a href="control-abstraction-objects.html#sec-iterable-interface">iterable</a></emu-xref> and returns their sum. If any value <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_10493"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">is not a Number</a></emu-xref> it throws a <emu-val>TypeError</emu-val> exception.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Perform ?&nbsp;<emu-xref aoid="RequireObjectCoercible" id="_ref_10494"><a href="abstract-operations.html#sec-requireobjectcoercible">RequireObjectCoercible</a></emu-xref>(<var>items</var>).</li><li>Let <var>iteratorRecord</var> be ?&nbsp;<emu-xref aoid="GetIterator" id="_ref_10495"><a href="abstract-operations.html#sec-getiterator" class="e-user-code">GetIterator</a></emu-xref>(<var>items</var>, <emu-const>sync</emu-const>).</li><li>Let <var>state</var> be <emu-const>minus-zero</emu-const>.</li><li>Let <var>sum</var> be 0.</li><li>Let <var>count</var> be 0.</li><li>Let <var>next</var> be <emu-const>not-started</emu-const>.</li><li>Repeat, while <var>next</var> is not <emu-const>done</emu-const>,<ol><li>Set <var>next</var> to ?&nbsp;<emu-xref aoid="IteratorStepValue" id="_ref_10496"><a href="abstract-operations.html#sec-iteratorstepvalue" class="e-user-code">IteratorStepValue</a></emu-xref>(<var>iteratorRecord</var>).</li><li>If <var>next</var> is not <emu-const>done</emu-const>, then<ol><li>If <var>count</var> ≥ 2<sup>53</sup> - 1, then<ol><li>NOTE: This step is not expected to be reached in practice and is included only so that implementations may rely on inputs being "reasonably sized" without violating this specification.</li><li>Let <var>error</var> be <emu-xref aoid="ThrowCompletion" id="_ref_10497"><a href="ecmascript-data-types-and-values.html#sec-throwcompletion">ThrowCompletion</a></emu-xref>(a newly created <emu-val>RangeError</emu-val> object).</li><li>Return ?&nbsp;<emu-xref aoid="IteratorClose" id="_ref_10498"><a href="abstract-operations.html#sec-iteratorclose" class="e-user-code">IteratorClose</a></emu-xref>(<var>iteratorRecord</var>, <var>error</var>).</li></ol></li><li>If <var>next</var> <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_10499"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">is not a Number</a></emu-xref>, then<ol><li>Let <var>error</var> be <emu-xref aoid="ThrowCompletion" id="_ref_10500"><a href="ecmascript-data-types-and-values.html#sec-throwcompletion">ThrowCompletion</a></emu-xref>(a newly created <emu-val>TypeError</emu-val> object).</li><li>Return ?&nbsp;<emu-xref aoid="IteratorClose" id="_ref_10501"><a href="abstract-operations.html#sec-iteratorclose" class="e-user-code">IteratorClose</a></emu-xref>(<var>iteratorRecord</var>, <var>error</var>).</li></ol></li><li>Let <var>n</var> be <var>next</var>.</li><li>If <var>state</var> is not <emu-const>not-a-number</emu-const>, then<ol><li>If <var>n</var> is <emu-val>NaN</emu-val>, then<ol><li>Set <var>state</var> to <emu-const>not-a-number</emu-const>.</li></ol></li><li>Else if <var>n</var> is <emu-val>+∞</emu-val><sub>𝔽</sub>, then<ol><li>If <var>state</var> is <emu-const>minus-infinity</emu-const>, set <var>state</var> to <emu-const>not-a-number</emu-const>.</li><li>Else, set <var>state</var> to <emu-const>plus-infinity</emu-const>.</li></ol></li><li>Else if <var>n</var> is <emu-val>-∞</emu-val><sub>𝔽</sub>, then<ol><li>If <var>state</var> is <emu-const>plus-infinity</emu-const>, set <var>state</var> to <emu-const>not-a-number</emu-const>.</li><li>Else, set <var>state</var> to <emu-const>minus-infinity</emu-const>.</li></ol></li><li>Else if <var>n</var> is not <emu-val>-0</emu-val><sub>𝔽</sub> and <var>state</var> is either <emu-const>minus-zero</emu-const> or <emu-const>finite</emu-const>, then<ol><li>Set <var>state</var> to <emu-const>finite</emu-const>.</li><li>Set <var>sum</var> to <var>sum</var> + <emu-xref aoid="" id="_ref_10502"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>).</li></ol></li></ol></li><li>Set <var>count</var> to <var>count</var> + 1.</li></ol></li></ol></li><li>If <var>state</var> is <emu-const>not-a-number</emu-const>, return <emu-val>NaN</emu-val>.</li><li>If <var>state</var> is <emu-const>plus-infinity</emu-const>, return <emu-val>+∞</emu-val><sub>𝔽</sub>.</li><li>If <var>state</var> is <emu-const>minus-infinity</emu-const>, return <emu-val>-∞</emu-val><sub>𝔽</sub>.</li><li>If <var>state</var> is <emu-const>minus-zero</emu-const>, return <emu-val>-0</emu-val><sub>𝔽</sub>.</li><li>Return <emu-xref aoid="𝔽" id="_ref_10503"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>sum</var>).</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The value of <var>sum</var> can be computed without arbitrary-precision arithmetic by a variety of algorithms. One such is the "Grow-Expansion" algorithm given in <i>Adaptive Precision Floating-Point Arithmetic and Fast Robust Geometric Predicates</i> by Jonathan Richard Shewchuk. A more recent algorithm is given in "<a href="https://arxiv.org/abs/1505.05571">Fast exact summation using small and large superaccumulators</a>", code for which is available at <a href="https://gitlab.com/radfordneal/xsum">https://gitlab.com/radfordneal/xsum</a>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-math.tan" type="built-in function">
<h1><span class="secnum">21.3.2.35</span> Math.tan ( <var>x</var> )</h1>
<p>This function returns the tangent of <var>x</var>. The argument is expressed in radians.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10504"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is one of <emu-val>NaN</emu-val>, <emu-val>+0</emu-val><sub>𝔽</sub>, or <emu-val>-0</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> is either <emu-val>+∞</emu-val><sub>𝔽</sub> or <emu-val>-∞</emu-val><sub>𝔽</sub>, return <emu-val>NaN</emu-val>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10505"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing the tangent of <emu-xref aoid="" id="_ref_10506"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-math.tanh" type="built-in function">
<h1><span class="secnum">21.3.2.36</span> Math.tanh ( <var>x</var> )</h1>
<p>This function returns the hyperbolic tangent of <var>x</var>.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10507"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is one of <emu-val>NaN</emu-val>, <emu-val>+0</emu-val><sub>𝔽</sub>, or <emu-val>-0</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> is <emu-val>+∞</emu-val><sub>𝔽</sub>, return <emu-val>1</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> is <emu-val>-∞</emu-val><sub>𝔽</sub>, return <emu-val>-1</emu-val><sub>𝔽</sub>.</li><li>Return an <emu-xref href="#implementation-approximated" id="_ref_10508"><a href="overview.html#implementation-approximated">implementation-approximated</a></emu-xref> Number value representing the hyperbolic tangent of <emu-xref aoid="" id="_ref_10509"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>n</var>).</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The value of <code>Math.tanh(x)</code> is the same as the value of <code>(Math.exp(x) - Math.exp(-x)) / (Math.exp(x) + Math.exp(-x))</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-math.trunc" type="built-in function">
<h1><span class="secnum">21.3.2.37</span> Math.trunc ( <var>x</var> )</h1>
<p>This function returns the integral part of the number <var>x</var>, removing any fractional digits. If <var>x</var> is already integral, the result is <var>x</var>.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>n</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10510"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>x</var>).</li><li>If <var>n</var> is not <emu-xref href="#finite" id="_ref_10511"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> or <var>n</var> is either <emu-val>+0</emu-val><sub>𝔽</sub> or <emu-val>-0</emu-val><sub>𝔽</sub>, return <var>n</var>.</li><li>If <var>n</var> &lt; <emu-val>1</emu-val><sub>𝔽</sub> and <var>n</var> &gt; <emu-val>+0</emu-val><sub>𝔽</sub>, return <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>n</var> &lt; <emu-val>-0</emu-val><sub>𝔽</sub> and <var>n</var> &gt; <emu-val>-1</emu-val><sub>𝔽</sub>, return <emu-val>-0</emu-val><sub>𝔽</sub>.</li><li>Return the <emu-xref href="#integral-number" id="_ref_10512"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> nearest <var>n</var> in the direction of <emu-val>+0</emu-val><sub>𝔽</sub>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
<emu-clause id="sec-date-objects">
<h1><span class="secnum">21.4</span> Date Objects</h1>
<emu-clause id="sec-overview-of-date-objects-and-definitions-of-abstract-operations">
<h1><span class="secnum">21.4.1</span> Overview of Date Objects and Definitions of Abstract Operations</h1>
<p>The following <emu-xref href="#sec-algorithm-conventions-abstract-operations" id="_ref_10513"><a href="notational-conventions.html#sec-algorithm-conventions-abstract-operations">abstract operations</a></emu-xref> operate on <emu-xref href="#sec-time-values-and-time-range" id="_ref_10514"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time values</a></emu-xref> (defined in <emu-xref href="#sec-time-values-and-time-range" id="_ref_639"><a href="numbers-and-dates.html#sec-time-values-and-time-range">21.4.1.1</a></emu-xref>). Note that, in every case, if any argument to one of these functions is <emu-val>NaN</emu-val>, the result will be <emu-val>NaN</emu-val>.</p>
<emu-clause id="sec-time-values-and-time-range">
<h1><span class="secnum">21.4.1.1</span> Time Values and Time Range</h1>
<p>Time measurement in ECMAScript is analogous to time measurement in POSIX, in particular sharing definition in terms of the proleptic Gregorian calendar, an <dfn id="epoch" tabindex="-1">epoch</dfn> of midnight at the beginning of 1 January 1970 UTC, and an accounting of every day as comprising exactly 86,400 seconds (each of which is 1000 milliseconds long).</p>
<p>An ECMAScript <dfn variants="time values" tabindex="-1">time value</dfn> <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_10515"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">is a Number</a></emu-xref>, either a <emu-xref href="#finite" id="_ref_10516"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> <emu-xref href="#integral-number" id="_ref_10517"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> representing an instant in time to millisecond precision or <emu-val>NaN</emu-val> representing no specific instant. A time value that is a multiple of <emu-eqn class="inline">24 × 60 × 60 × 1000 = 86,400,000</emu-eqn> (i.e., is 86,400,000 × <var>d</var> for some <emu-xref href="#integer" id="_ref_10518"><a href="notational-conventions.html#integer">integer</a></emu-xref> <var>d</var>) represents the instant at the start of the UTC day that follows the <emu-xref href="#epoch" id="_ref_10519"><a href="numbers-and-dates.html#epoch">epoch</a></emu-xref> by <var>d</var> whole UTC days (preceding the <emu-xref href="#epoch" id="_ref_10520"><a href="numbers-and-dates.html#epoch">epoch</a></emu-xref> for negative <var>d</var>). Every other <emu-xref href="#finite" id="_ref_10521"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> time value <var>t</var> is defined relative to the greatest preceding time value <var>s</var> that is such a multiple, and represents the instant that occurs within the same UTC day as <var>s</var> but follows it by (<var>t</var> - <var>s</var>) milliseconds.</p>
<p>Time values do not account for UTC leap seconds—there are no time values representing instants within positive leap seconds, and there are time values representing instants removed from the UTC timeline by negative leap seconds. However, the definition of time values nonetheless yields piecewise alignment with UTC, with discontinuities only at leap second boundaries and zero difference outside of leap seconds.</p>
<p>A Number can exactly represent all <emu-xref href="#integer" id="_ref_10522"><a href="notational-conventions.html#integer">integers</a></emu-xref> from -9,007,199,254,740,992 to 9,007,199,254,740,992 (<emu-xref href="#sec-number.min_safe_integer" id="_ref_640"><a href="numbers-and-dates.html#sec-number.min_safe_integer">21.1.2.8</a></emu-xref> and <emu-xref href="#sec-number.max_safe_integer" id="_ref_641"><a href="numbers-and-dates.html#sec-number.max_safe_integer">21.1.2.6</a></emu-xref>). A time value supports a slightly smaller range of -8,640,000,000,000,000 to 8,640,000,000,000,000 milliseconds. This yields a supported time value range of exactly -100,000,000 days to 100,000,000 days relative to midnight at the beginning of 1 January 1970 UTC.</p>
<p>The exact moment of midnight at the beginning of 1 January 1970 UTC is represented by the time value <emu-val>+0</emu-val><sub>𝔽</sub>.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>In the proleptic Gregorian calendar, leap years are precisely those which are both divisible by 4 and either divisible by 400 or not divisible by 100.</p>
<p>The 400 year cycle of the proleptic Gregorian calendar contains 97 leap years. This yields an average of 365.2425 days per year, which is 31,556,952,000 milliseconds. Therefore, the maximum range a Number could represent exactly with millisecond precision is approximately -285,426 to 285,426 years relative to 1970. The smaller range supported by a time value as specified in this section is approximately -273,790 to 273,790 years relative to 1970.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-time-related-constants">
<h1><span class="secnum">21.4.1.2</span> Time-related Constants</h1>
<p>These constants are referenced by algorithms in the following sections.</p>
<emu-eqn id="eqn-HoursPerDay" aoid="HoursPerDay"><div>HoursPerDay = 24</div></emu-eqn>
<emu-eqn id="eqn-MinutesPerHour" aoid="MinutesPerHour"><div>MinutesPerHour = 60</div></emu-eqn>
<emu-eqn id="eqn-SecondsPerMinute" aoid="SecondsPerMinute"><div>SecondsPerMinute = 60</div></emu-eqn>
<emu-eqn id="eqn-msPerSecond" aoid="msPerSecond"><div>msPerSecond = <emu-val>1000</emu-val><sub>𝔽</sub></div></emu-eqn>
<emu-eqn id="eqn-msPerMinute" aoid="msPerMinute"><div>msPerMinute = <emu-val>60000</emu-val><sub>𝔽</sub> = <emu-xref aoid="msPerSecond" id="_ref_10523"><a href="numbers-and-dates.html#eqn-msPerSecond">msPerSecond</a></emu-xref> × <emu-xref aoid="𝔽" id="_ref_10524"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<emu-xref aoid="SecondsPerMinute" id="_ref_10525"><a href="numbers-and-dates.html#eqn-SecondsPerMinute">SecondsPerMinute</a></emu-xref>)</div></emu-eqn>
<emu-eqn id="eqn-msPerHour" aoid="msPerHour"><div>msPerHour = <emu-val>3600000</emu-val><sub>𝔽</sub> = <emu-xref aoid="msPerMinute" id="_ref_10526"><a href="numbers-and-dates.html#eqn-msPerMinute">msPerMinute</a></emu-xref> × <emu-xref aoid="𝔽" id="_ref_10527"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<emu-xref aoid="MinutesPerHour" id="_ref_10528"><a href="numbers-and-dates.html#eqn-MinutesPerHour">MinutesPerHour</a></emu-xref>)</div></emu-eqn>
<emu-eqn id="eqn-msPerDay" aoid="msPerDay"><div>msPerDay = <emu-val>86400000</emu-val><sub>𝔽</sub> = <emu-xref aoid="msPerHour" id="_ref_10529"><a href="numbers-and-dates.html#eqn-msPerHour">msPerHour</a></emu-xref> × <emu-xref aoid="𝔽" id="_ref_10530"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<emu-xref aoid="HoursPerDay" id="_ref_10531"><a href="numbers-and-dates.html#eqn-HoursPerDay">HoursPerDay</a></emu-xref>)</div></emu-eqn>
</emu-clause>
<emu-clause id="sec-day" type="abstract operation" oldids="eqn-Day,sec-day-number-and-time-within-day" aoid="Day"><span id="sec-day-number-and-time-within-day"></span><span id="eqn-Day"></span>
<h1><span class="secnum">21.4.1.3</span> Day ( <var>t</var> )</h1>
<p>The abstract operation Day takes argument <var>t</var> (a <emu-xref href="#finite" id="_ref_10532"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> <emu-xref href="#sec-time-values-and-time-range" id="_ref_10533"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>) and returns an <emu-xref href="#integral-number" id="_ref_10534"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>. It returns the day number of the day in which <var>t</var> falls. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="𝔽" id="_ref_10535"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<emu-xref aoid="floor" id="_ref_10536"><a href="notational-conventions.html#eqn-floor">floor</a></emu-xref>(<emu-xref aoid="" id="_ref_10537"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>t</var> / <emu-xref aoid="msPerDay" id="_ref_10538"><a href="numbers-and-dates.html#eqn-msPerDay">msPerDay</a></emu-xref>))).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-timewithinday" type="abstract operation" oldids="eqn-TimeWithinDay" aoid="TimeWithinDay"><span id="eqn-TimeWithinDay"></span>
<h1><span class="secnum">21.4.1.4</span> TimeWithinDay ( <var>t</var> )</h1>
<p>The abstract operation TimeWithinDay takes argument <var>t</var> (a <emu-xref href="#finite" id="_ref_10539"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> <emu-xref href="#sec-time-values-and-time-range" id="_ref_10540"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>) and returns an <emu-xref href="#integral-number" id="_ref_10541"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> in the <emu-xref href="#interval" id="_ref_10542"><a href="notational-conventions.html#interval">interval</a></emu-xref> from <emu-val>+0</emu-val><sub>𝔽</sub> (inclusive) to <emu-xref aoid="msPerDay" id="_ref_10543"><a href="numbers-and-dates.html#eqn-msPerDay">msPerDay</a></emu-xref> (exclusive). It returns the number of milliseconds since the start of the day in which <var>t</var> falls. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="𝔽" id="_ref_10544"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<emu-xref aoid="" id="_ref_10545"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>t</var>) <emu-xref aoid="modulo" id="_ref_10546"><a href="notational-conventions.html#eqn-modulo">modulo</a></emu-xref> <emu-xref aoid="" id="_ref_10547"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="msPerDay" id="_ref_10548"><a href="numbers-and-dates.html#eqn-msPerDay">msPerDay</a></emu-xref>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-daysinyear" type="abstract operation" oldids="eqn-DaysInYear,sec-year-number" aoid="DaysInYear"><span id="sec-year-number"></span><span id="eqn-DaysInYear"></span>
<h1><span class="secnum">21.4.1.5</span> DaysInYear ( <var>y</var> )</h1>
<p>The abstract operation DaysInYear takes argument <var>y</var> (an <emu-xref href="#integral-number" id="_ref_10549"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>) and returns <emu-val>365</emu-val><sub>𝔽</sub> or <emu-val>366</emu-val><sub>𝔽</sub>. It returns the number of days in year <var>y</var>. Leap years have 366 days; all other years have 365. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>ry</var> be <emu-xref aoid="" id="_ref_10550"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>y</var>).</li><li>If (<var>ry</var> <emu-xref aoid="modulo" id="_ref_10551"><a href="notational-conventions.html#eqn-modulo">modulo</a></emu-xref> 400) = 0, return <emu-val>366</emu-val><sub>𝔽</sub>.</li><li>If (<var>ry</var> <emu-xref aoid="modulo" id="_ref_10552"><a href="notational-conventions.html#eqn-modulo">modulo</a></emu-xref> 100) = 0, return <emu-val>365</emu-val><sub>𝔽</sub>.</li><li>If (<var>ry</var> <emu-xref aoid="modulo" id="_ref_10553"><a href="notational-conventions.html#eqn-modulo">modulo</a></emu-xref> 4) = 0, return <emu-val>366</emu-val><sub>𝔽</sub>.</li><li>Return <emu-val>365</emu-val><sub>𝔽</sub>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-dayfromyear" type="abstract operation" oldids="eqn-DaysFromYear" aoid="DayFromYear"><span id="eqn-DaysFromYear"></span>
<h1><span class="secnum">21.4.1.6</span> DayFromYear ( <var>y</var> )</h1>
<p>The abstract operation DayFromYear takes argument <var>y</var> (an <emu-xref href="#integral-number" id="_ref_10554"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>) and returns an <emu-xref href="#integral-number" id="_ref_10555"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>. It returns the day number of the first day of year <var>y</var>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>ry</var> be <emu-xref aoid="" id="_ref_10556"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>y</var>).</li><li declared="numYears1,numYears4,numYears100,numYears400">NOTE: In the following steps, <var>numYears1</var>, <var>numYears4</var>, <var>numYears100</var>, and <var>numYears400</var> represent the number of years divisible by 1, 4, 100, and 400, respectively, that occur between the <emu-xref href="#epoch" id="_ref_10557"><a href="numbers-and-dates.html#epoch">epoch</a></emu-xref> and the start of year <var>y</var>. The number is negative if <var>y</var> is before the <emu-xref href="#epoch" id="_ref_10558"><a href="numbers-and-dates.html#epoch">epoch</a></emu-xref>.</li><li>Let <var>numYears1</var> be (<var>ry</var> - 1970).</li><li>Let <var>numYears4</var> be <emu-xref aoid="floor" id="_ref_10559"><a href="notational-conventions.html#eqn-floor">floor</a></emu-xref>((<var>ry</var> - 1969) / 4).</li><li>Let <var>numYears100</var> be <emu-xref aoid="floor" id="_ref_10560"><a href="notational-conventions.html#eqn-floor">floor</a></emu-xref>((<var>ry</var> - 1901) / 100).</li><li>Let <var>numYears400</var> be <emu-xref aoid="floor" id="_ref_10561"><a href="notational-conventions.html#eqn-floor">floor</a></emu-xref>((<var>ry</var> - 1601) / 400).</li><li>Return <emu-xref aoid="𝔽" id="_ref_10562"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(365 × <var>numYears1</var> + <var>numYears4</var> - <var>numYears100</var> + <var>numYears400</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-timefromyear" type="abstract operation" oldids="eqn-TimeFromYear" aoid="TimeFromYear"><span id="eqn-TimeFromYear"></span>
<h1><span class="secnum">21.4.1.7</span> TimeFromYear ( <var>y</var> )</h1>
<p>The abstract operation TimeFromYear takes argument <var>y</var> (an <emu-xref href="#integral-number" id="_ref_10563"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>) and returns a <emu-xref href="#sec-time-values-and-time-range" id="_ref_10564"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>. It returns the <emu-xref href="#sec-time-values-and-time-range" id="_ref_10565"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref> of the start of year <var>y</var>. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="msPerDay" id="_ref_10566"><a href="numbers-and-dates.html#eqn-msPerDay">msPerDay</a></emu-xref> × <emu-xref aoid="DayFromYear" id="_ref_10567"><a href="numbers-and-dates.html#sec-dayfromyear">DayFromYear</a></emu-xref>(<var>y</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-yearfromtime" type="abstract operation" oldids="eqn-YearFromTime" aoid="YearFromTime"><span id="eqn-YearFromTime"></span>
<h1><span class="secnum">21.4.1.8</span> YearFromTime ( <var>t</var> )</h1>
<p>The abstract operation YearFromTime takes argument <var>t</var> (a <emu-xref href="#finite" id="_ref_10568"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> <emu-xref href="#sec-time-values-and-time-range" id="_ref_10569"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>) and returns an <emu-xref href="#integral-number" id="_ref_10570"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>. It returns the year in which <var>t</var> falls. It performs the following steps when called:</p>
<emu-alg><ol><li declared="y">Return the largest <emu-xref href="#integral-number" id="_ref_10571"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> <var>y</var> (closest to +∞) such that <emu-xref aoid="TimeFromYear" id="_ref_10572"><a href="numbers-and-dates.html#sec-timefromyear">TimeFromYear</a></emu-xref>(<var>y</var>) ≤ <var>t</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-daywithinyear" type="abstract operation" oldids="eqn-DayWithinYear" aoid="DayWithinYear"><span id="eqn-DayWithinYear"></span>
<h1><span class="secnum">21.4.1.9</span> DayWithinYear ( <var>t</var> )</h1>
<p>The abstract operation DayWithinYear takes argument <var>t</var> (a <emu-xref href="#finite" id="_ref_10573"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> <emu-xref href="#sec-time-values-and-time-range" id="_ref_10574"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>) and returns an <emu-xref href="#integral-number" id="_ref_10575"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10576"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from <emu-val>+0</emu-val><sub>𝔽</sub> to <emu-val>365</emu-val><sub>𝔽</sub>. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="Day" id="_ref_10577"><a href="numbers-and-dates.html#sec-day">Day</a></emu-xref>(<var>t</var>) - <emu-xref aoid="DayFromYear" id="_ref_10578"><a href="numbers-and-dates.html#sec-dayfromyear">DayFromYear</a></emu-xref>(<emu-xref aoid="YearFromTime" id="_ref_10579"><a href="numbers-and-dates.html#sec-yearfromtime">YearFromTime</a></emu-xref>(<var>t</var>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-inleapyear" type="abstract operation" oldids="eqn-InLeapYear" aoid="InLeapYear"><span id="eqn-InLeapYear"></span>
<h1><span class="secnum">21.4.1.10</span> InLeapYear ( <var>t</var> )</h1>
<p>The abstract operation InLeapYear takes argument <var>t</var> (a <emu-xref href="#finite" id="_ref_10580"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> <emu-xref href="#sec-time-values-and-time-range" id="_ref_10581"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>) and returns <emu-val>+0</emu-val><sub>𝔽</sub> or <emu-val>1</emu-val><sub>𝔽</sub>. It returns <emu-val>1</emu-val><sub>𝔽</sub> if <var>t</var> is within a leap year and <emu-val>+0</emu-val><sub>𝔽</sub> otherwise. It performs the following steps when called:</p>
<emu-alg><ol><li>If <emu-xref aoid="DaysInYear" id="_ref_10582"><a href="numbers-and-dates.html#sec-daysinyear">DaysInYear</a></emu-xref>(<emu-xref aoid="YearFromTime" id="_ref_10583"><a href="numbers-and-dates.html#sec-yearfromtime">YearFromTime</a></emu-xref>(<var>t</var>)) is <emu-val>366</emu-val><sub>𝔽</sub>, return <emu-val>1</emu-val><sub>𝔽</sub>.</li><li>Return <emu-val>+0</emu-val><sub>𝔽</sub>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-monthfromtime" type="abstract operation" oldids="eqn-MonthFromTime,sec-month-number" aoid="MonthFromTime"><span id="sec-month-number"></span><span id="eqn-MonthFromTime"></span>
<h1><span class="secnum">21.4.1.11</span> MonthFromTime ( <var>t</var> )</h1>
<p>The abstract operation MonthFromTime takes argument <var>t</var> (a <emu-xref href="#finite" id="_ref_10584"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> <emu-xref href="#sec-time-values-and-time-range" id="_ref_10585"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>) and returns an <emu-xref href="#integral-number" id="_ref_10586"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10587"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from <emu-val>+0</emu-val><sub>𝔽</sub> to <emu-val>11</emu-val><sub>𝔽</sub>. It returns a Number identifying the month in which <var>t</var> falls. A month value of <emu-val>+0</emu-val><sub>𝔽</sub> specifies January; <emu-val>1</emu-val><sub>𝔽</sub> specifies February; <emu-val>2</emu-val><sub>𝔽</sub> specifies March; <emu-val>3</emu-val><sub>𝔽</sub> specifies April; <emu-val>4</emu-val><sub>𝔽</sub> specifies May; <emu-val>5</emu-val><sub>𝔽</sub> specifies June; <emu-val>6</emu-val><sub>𝔽</sub> specifies July; <emu-val>7</emu-val><sub>𝔽</sub> specifies August; <emu-val>8</emu-val><sub>𝔽</sub> specifies September; <emu-val>9</emu-val><sub>𝔽</sub> specifies October; <emu-val>10</emu-val><sub>𝔽</sub> specifies November; and <emu-val>11</emu-val><sub>𝔽</sub> specifies December. Note that <emu-eqn class="inline">MonthFromTime(<emu-val>+0</emu-val><sub>𝔽</sub>) = <emu-val>+0</emu-val><sub>𝔽</sub></emu-eqn>, corresponding to Thursday, 1 January 1970. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>inLeapYear</var> be <emu-xref aoid="InLeapYear" id="_ref_10588"><a href="numbers-and-dates.html#sec-inleapyear">InLeapYear</a></emu-xref>(<var>t</var>).</li><li>Let <var>dayWithinYear</var> be <emu-xref aoid="DayWithinYear" id="_ref_10589"><a href="numbers-and-dates.html#sec-daywithinyear">DayWithinYear</a></emu-xref>(<var>t</var>).</li><li>If <var>dayWithinYear</var> &lt; <emu-val>31</emu-val><sub>𝔽</sub>, return <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>dayWithinYear</var> &lt; <emu-val>59</emu-val><sub>𝔽</sub> + <var>inLeapYear</var>, return <emu-val>1</emu-val><sub>𝔽</sub>.</li><li>If <var>dayWithinYear</var> &lt; <emu-val>90</emu-val><sub>𝔽</sub> + <var>inLeapYear</var>, return <emu-val>2</emu-val><sub>𝔽</sub>.</li><li>If <var>dayWithinYear</var> &lt; <emu-val>120</emu-val><sub>𝔽</sub> + <var>inLeapYear</var>, return <emu-val>3</emu-val><sub>𝔽</sub>.</li><li>If <var>dayWithinYear</var> &lt; <emu-val>151</emu-val><sub>𝔽</sub> + <var>inLeapYear</var>, return <emu-val>4</emu-val><sub>𝔽</sub>.</li><li>If <var>dayWithinYear</var> &lt; <emu-val>181</emu-val><sub>𝔽</sub> + <var>inLeapYear</var>, return <emu-val>5</emu-val><sub>𝔽</sub>.</li><li>If <var>dayWithinYear</var> &lt; <emu-val>212</emu-val><sub>𝔽</sub> + <var>inLeapYear</var>, return <emu-val>6</emu-val><sub>𝔽</sub>.</li><li>If <var>dayWithinYear</var> &lt; <emu-val>243</emu-val><sub>𝔽</sub> + <var>inLeapYear</var>, return <emu-val>7</emu-val><sub>𝔽</sub>.</li><li>If <var>dayWithinYear</var> &lt; <emu-val>273</emu-val><sub>𝔽</sub> + <var>inLeapYear</var>, return <emu-val>8</emu-val><sub>𝔽</sub>.</li><li>If <var>dayWithinYear</var> &lt; <emu-val>304</emu-val><sub>𝔽</sub> + <var>inLeapYear</var>, return <emu-val>9</emu-val><sub>𝔽</sub>.</li><li>If <var>dayWithinYear</var> &lt; <emu-val>334</emu-val><sub>𝔽</sub> + <var>inLeapYear</var>, return <emu-val>10</emu-val><sub>𝔽</sub>.</li><li><emu-xref href="#assert" id="_ref_10590"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>dayWithinYear</var> &lt; <emu-val>365</emu-val><sub>𝔽</sub> + <var>inLeapYear</var>.</li><li>Return <emu-val>11</emu-val><sub>𝔽</sub>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-datefromtime" type="abstract operation" oldids="sec-date-number" aoid="DateFromTime"><span id="sec-date-number"></span>
<h1><span class="secnum">21.4.1.12</span> DateFromTime ( <var>t</var> )</h1>
<p>The abstract operation DateFromTime takes argument <var>t</var> (a <emu-xref href="#finite" id="_ref_10591"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> <emu-xref href="#sec-time-values-and-time-range" id="_ref_10592"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>) and returns an <emu-xref href="#integral-number" id="_ref_10593"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10594"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from <emu-val>1</emu-val><sub>𝔽</sub> to <emu-val>31</emu-val><sub>𝔽</sub>. It returns the day of the month in which <var>t</var> falls. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>inLeapYear</var> be <emu-xref aoid="InLeapYear" id="_ref_10595"><a href="numbers-and-dates.html#sec-inleapyear">InLeapYear</a></emu-xref>(<var>t</var>).</li><li>Let <var>dayWithinYear</var> be <emu-xref aoid="DayWithinYear" id="_ref_10596"><a href="numbers-and-dates.html#sec-daywithinyear">DayWithinYear</a></emu-xref>(<var>t</var>).</li><li>Let <var>month</var> be <emu-xref aoid="MonthFromTime" id="_ref_10597"><a href="numbers-and-dates.html#sec-monthfromtime">MonthFromTime</a></emu-xref>(<var>t</var>).</li><li>If <var>month</var> is <emu-val>+0</emu-val><sub>𝔽</sub>, return <var>dayWithinYear</var> + <emu-val>1</emu-val><sub>𝔽</sub>.</li><li>If <var>month</var> is <emu-val>1</emu-val><sub>𝔽</sub>, return <var>dayWithinYear</var> - <emu-val>30</emu-val><sub>𝔽</sub>.</li><li>If <var>month</var> is <emu-val>2</emu-val><sub>𝔽</sub>, return <var>dayWithinYear</var> - <emu-val>58</emu-val><sub>𝔽</sub> - <var>inLeapYear</var>.</li><li>If <var>month</var> is <emu-val>3</emu-val><sub>𝔽</sub>, return <var>dayWithinYear</var> - <emu-val>89</emu-val><sub>𝔽</sub> - <var>inLeapYear</var>.</li><li>If <var>month</var> is <emu-val>4</emu-val><sub>𝔽</sub>, return <var>dayWithinYear</var> - <emu-val>119</emu-val><sub>𝔽</sub> - <var>inLeapYear</var>.</li><li>If <var>month</var> is <emu-val>5</emu-val><sub>𝔽</sub>, return <var>dayWithinYear</var> - <emu-val>150</emu-val><sub>𝔽</sub> - <var>inLeapYear</var>.</li><li>If <var>month</var> is <emu-val>6</emu-val><sub>𝔽</sub>, return <var>dayWithinYear</var> - <emu-val>180</emu-val><sub>𝔽</sub> - <var>inLeapYear</var>.</li><li>If <var>month</var> is <emu-val>7</emu-val><sub>𝔽</sub>, return <var>dayWithinYear</var> - <emu-val>211</emu-val><sub>𝔽</sub> - <var>inLeapYear</var>.</li><li>If <var>month</var> is <emu-val>8</emu-val><sub>𝔽</sub>, return <var>dayWithinYear</var> - <emu-val>242</emu-val><sub>𝔽</sub> - <var>inLeapYear</var>.</li><li>If <var>month</var> is <emu-val>9</emu-val><sub>𝔽</sub>, return <var>dayWithinYear</var> - <emu-val>272</emu-val><sub>𝔽</sub> - <var>inLeapYear</var>.</li><li>If <var>month</var> is <emu-val>10</emu-val><sub>𝔽</sub>, return <var>dayWithinYear</var> - <emu-val>303</emu-val><sub>𝔽</sub> - <var>inLeapYear</var>.</li><li><emu-xref href="#assert" id="_ref_10598"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>month</var> is <emu-val>11</emu-val><sub>𝔽</sub>.</li><li>Return <var>dayWithinYear</var> - <emu-val>333</emu-val><sub>𝔽</sub> - <var>inLeapYear</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-weekday" type="abstract operation" oldids="sec-week-day" aoid="WeekDay"><span id="sec-week-day"></span>
<h1><span class="secnum">21.4.1.13</span> WeekDay ( <var>t</var> )</h1>
<p>The abstract operation WeekDay takes argument <var>t</var> (a <emu-xref href="#finite" id="_ref_10599"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> <emu-xref href="#sec-time-values-and-time-range" id="_ref_10600"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>) and returns an <emu-xref href="#integral-number" id="_ref_10601"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10602"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from <emu-val>+0</emu-val><sub>𝔽</sub> to <emu-val>6</emu-val><sub>𝔽</sub>. It returns a Number identifying the day of the week in which <var>t</var> falls. A weekday value of <emu-val>+0</emu-val><sub>𝔽</sub> specifies Sunday; <emu-val>1</emu-val><sub>𝔽</sub> specifies Monday; <emu-val>2</emu-val><sub>𝔽</sub> specifies Tuesday; <emu-val>3</emu-val><sub>𝔽</sub> specifies Wednesday; <emu-val>4</emu-val><sub>𝔽</sub> specifies Thursday; <emu-val>5</emu-val><sub>𝔽</sub> specifies Friday; and <emu-val>6</emu-val><sub>𝔽</sub> specifies Saturday. Note that <emu-eqn class="inline">WeekDay(<emu-val>+0</emu-val><sub>𝔽</sub>) = <emu-val>4</emu-val><sub>𝔽</sub></emu-eqn>, corresponding to Thursday, 1 January 1970. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="𝔽" id="_ref_10603"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<emu-xref aoid="" id="_ref_10604"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="Day" id="_ref_10605"><a href="numbers-and-dates.html#sec-day">Day</a></emu-xref>(<var>t</var>) + <emu-val>4</emu-val><sub>𝔽</sub>) <emu-xref aoid="modulo" id="_ref_10606"><a href="notational-conventions.html#eqn-modulo">modulo</a></emu-xref> 7).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-hourfromtime" type="abstract operation" oldids="eqn-HourFromTime,sec-hours-minutes-second-and-milliseconds" aoid="HourFromTime"><span id="sec-hours-minutes-second-and-milliseconds"></span><span id="eqn-HourFromTime"></span>
<h1><span class="secnum">21.4.1.14</span> HourFromTime ( <var>t</var> )</h1>
<p>The abstract operation HourFromTime takes argument <var>t</var> (a <emu-xref href="#finite" id="_ref_10607"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> <emu-xref href="#sec-time-values-and-time-range" id="_ref_10608"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>) and returns an <emu-xref href="#integral-number" id="_ref_10609"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10610"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from <emu-val>+0</emu-val><sub>𝔽</sub> to <emu-val>23</emu-val><sub>𝔽</sub>. It returns the hour of the day in which <var>t</var> falls. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="𝔽" id="_ref_10611"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<emu-xref aoid="floor" id="_ref_10612"><a href="notational-conventions.html#eqn-floor">floor</a></emu-xref>(<emu-xref aoid="" id="_ref_10613"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>t</var> / <emu-xref aoid="msPerHour" id="_ref_10614"><a href="numbers-and-dates.html#eqn-msPerHour">msPerHour</a></emu-xref>)) <emu-xref aoid="modulo" id="_ref_10615"><a href="notational-conventions.html#eqn-modulo">modulo</a></emu-xref> <emu-xref aoid="HoursPerDay" id="_ref_10616"><a href="numbers-and-dates.html#eqn-HoursPerDay">HoursPerDay</a></emu-xref>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-minfromtime" type="abstract operation" oldids="eqn-MinFromTime" aoid="MinFromTime"><span id="eqn-MinFromTime"></span>
<h1><span class="secnum">21.4.1.15</span> MinFromTime ( <var>t</var> )</h1>
<p>The abstract operation MinFromTime takes argument <var>t</var> (a <emu-xref href="#finite" id="_ref_10617"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> <emu-xref href="#sec-time-values-and-time-range" id="_ref_10618"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>) and returns an <emu-xref href="#integral-number" id="_ref_10619"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10620"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from <emu-val>+0</emu-val><sub>𝔽</sub> to <emu-val>59</emu-val><sub>𝔽</sub>. It returns the minute of the hour in which <var>t</var> falls. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="𝔽" id="_ref_10621"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<emu-xref aoid="floor" id="_ref_10622"><a href="notational-conventions.html#eqn-floor">floor</a></emu-xref>(<emu-xref aoid="" id="_ref_10623"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>t</var> / <emu-xref aoid="msPerMinute" id="_ref_10624"><a href="numbers-and-dates.html#eqn-msPerMinute">msPerMinute</a></emu-xref>)) <emu-xref aoid="modulo" id="_ref_10625"><a href="notational-conventions.html#eqn-modulo">modulo</a></emu-xref> <emu-xref aoid="MinutesPerHour" id="_ref_10626"><a href="numbers-and-dates.html#eqn-MinutesPerHour">MinutesPerHour</a></emu-xref>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-secfromtime" type="abstract operation" oldids="eqn-SecFromTime" aoid="SecFromTime"><span id="eqn-SecFromTime"></span>
<h1><span class="secnum">21.4.1.16</span> SecFromTime ( <var>t</var> )</h1>
<p>The abstract operation SecFromTime takes argument <var>t</var> (a <emu-xref href="#finite" id="_ref_10627"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> <emu-xref href="#sec-time-values-and-time-range" id="_ref_10628"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>) and returns an <emu-xref href="#integral-number" id="_ref_10629"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10630"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from <emu-val>+0</emu-val><sub>𝔽</sub> to <emu-val>59</emu-val><sub>𝔽</sub>. It returns the second of the minute in which <var>t</var> falls. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="𝔽" id="_ref_10631"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<emu-xref aoid="floor" id="_ref_10632"><a href="notational-conventions.html#eqn-floor">floor</a></emu-xref>(<emu-xref aoid="" id="_ref_10633"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>t</var> / <emu-xref aoid="msPerSecond" id="_ref_10634"><a href="numbers-and-dates.html#eqn-msPerSecond">msPerSecond</a></emu-xref>)) <emu-xref aoid="modulo" id="_ref_10635"><a href="notational-conventions.html#eqn-modulo">modulo</a></emu-xref> <emu-xref aoid="SecondsPerMinute" id="_ref_10636"><a href="numbers-and-dates.html#eqn-SecondsPerMinute">SecondsPerMinute</a></emu-xref>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-msfromtime" type="abstract operation" oldids="eqn-msFromTime" aoid="msFromTime"><span id="eqn-msFromTime"></span>
<h1><span class="secnum">21.4.1.17</span> msFromTime ( <var>t</var> )</h1>
<p>The abstract operation msFromTime takes argument <var>t</var> (a <emu-xref href="#finite" id="_ref_10637"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> <emu-xref href="#sec-time-values-and-time-range" id="_ref_10638"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>) and returns an <emu-xref href="#integral-number" id="_ref_10639"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10640"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from <emu-val>+0</emu-val><sub>𝔽</sub> to <emu-val>999</emu-val><sub>𝔽</sub>. It returns the millisecond of the second in which <var>t</var> falls. It performs the following steps when called:</p>
<emu-alg><ol><li>Return <emu-xref aoid="𝔽" id="_ref_10641"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<emu-xref aoid="" id="_ref_10642"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>t</var>) <emu-xref aoid="modulo" id="_ref_10643"><a href="notational-conventions.html#eqn-modulo">modulo</a></emu-xref> <emu-xref aoid="" id="_ref_10644"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="msPerSecond" id="_ref_10645"><a href="numbers-and-dates.html#eqn-msPerSecond">msPerSecond</a></emu-xref>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-getutcepochnanoseconds" type="abstract operation" aoid="GetUTCEpochNanoseconds">
<h1><span class="secnum">21.4.1.18</span> GetUTCEpochNanoseconds ( <var>year</var>, <var>month</var>, <var>day</var>, <var>hour</var>, <var>minute</var>, <var>second</var>, <var>millisecond</var>, <var>microsecond</var>, <var>nanosecond</var> )</h1>
<p>The abstract operation GetUTCEpochNanoseconds takes arguments <var>year</var> (an <emu-xref href="#integer" id="_ref_10646"><a href="notational-conventions.html#integer">integer</a></emu-xref>), <var>month</var> (an <emu-xref href="#integer" id="_ref_10647"><a href="notational-conventions.html#integer">integer</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10648"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 1 to 12), <var>day</var> (an <emu-xref href="#integer" id="_ref_10649"><a href="notational-conventions.html#integer">integer</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10650"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 1 to 31), <var>hour</var> (an <emu-xref href="#integer" id="_ref_10651"><a href="notational-conventions.html#integer">integer</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10652"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 0 to 23), <var>minute</var> (an <emu-xref href="#integer" id="_ref_10653"><a href="notational-conventions.html#integer">integer</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10654"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 0 to 59), <var>second</var> (an <emu-xref href="#integer" id="_ref_10655"><a href="notational-conventions.html#integer">integer</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10656"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 0 to 59), <var>millisecond</var> (an <emu-xref href="#integer" id="_ref_10657"><a href="notational-conventions.html#integer">integer</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10658"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 0 to 999), <var>microsecond</var> (an <emu-xref href="#integer" id="_ref_10659"><a href="notational-conventions.html#integer">integer</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10660"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 0 to 999), and <var>nanosecond</var> (an <emu-xref href="#integer" id="_ref_10661"><a href="notational-conventions.html#integer">integer</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10662"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 0 to 999) and returns a BigInt. The returned value represents a number of nanoseconds since the <emu-xref href="#epoch" id="_ref_10663"><a href="numbers-and-dates.html#epoch">epoch</a></emu-xref> that corresponds to the given ISO 8601 calendar date and wall-clock time in UTC. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>date</var> be <emu-xref aoid="MakeDay" id="_ref_10664"><a href="numbers-and-dates.html#sec-makeday">MakeDay</a></emu-xref>(<emu-xref aoid="𝔽" id="_ref_10665"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>year</var>), <emu-xref aoid="𝔽" id="_ref_10666"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>month</var> - 1), <emu-xref aoid="𝔽" id="_ref_10667"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>day</var>)).</li><li>Let <var>time</var> be <emu-xref aoid="MakeTime" id="_ref_10668"><a href="numbers-and-dates.html#sec-maketime">MakeTime</a></emu-xref>(<emu-xref aoid="𝔽" id="_ref_10669"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>hour</var>), <emu-xref aoid="𝔽" id="_ref_10670"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>minute</var>), <emu-xref aoid="𝔽" id="_ref_10671"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>second</var>), <emu-xref aoid="𝔽" id="_ref_10672"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>millisecond</var>)).</li><li>Let <var>ms</var> be <emu-xref aoid="MakeDate" id="_ref_10673"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<var>date</var>, <var>time</var>).</li><li><emu-xref href="#assert" id="_ref_10674"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>ms</var> is an <emu-xref href="#integral-number" id="_ref_10675"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>.</li><li>Return <emu-xref aoid="" id="_ref_10676"><a href="notational-conventions.html#%E2%84%A4"></a></emu-xref>(<emu-xref aoid="" id="_ref_10677"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>ms</var>) × 10<sup>6</sup> + <var>microsecond</var> × 10<sup>3</sup> + <var>nanosecond</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-time-zone-identifiers">
<h1><span class="secnum">21.4.1.19</span> Time Zone Identifiers</h1>
<p>
Time zones in ECMAScript are represented by <dfn variants="time zone identifier" tabindex="-1">time zone identifiers</dfn>, which are Strings composed entirely of code units in the <emu-xref href="#inclusive-interval" id="_ref_10678"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 0x0000 to 0x007F.
Time zones supported by an ECMAScript implementation may be <dfn variants="available named time zone" tabindex="-1">available named time zones</dfn>, represented by the <var class="field">[[Identifier]]</var> field of the <emu-xref href="#sec-time-zone-identifier-record" id="_ref_10679"><a href="numbers-and-dates.html#sec-time-zone-identifier-record">Time Zone Identifier Records</a></emu-xref> returned by <emu-xref aoid="AvailableNamedTimeZoneIdentifiers" id="_ref_10680"><a href="numbers-and-dates.html#sec-availablenamedtimezoneidentifiers">AvailableNamedTimeZoneIdentifiers</a></emu-xref>, or <dfn variants="offset time zone" tabindex="-1">offset time zones</dfn>, represented by Strings for which <emu-xref aoid="IsTimeZoneOffsetString" id="_ref_10681"><a href="numbers-and-dates.html#sec-istimezoneoffsetstring">IsTimeZoneOffsetString</a></emu-xref> returns <emu-val>true</emu-val>.
</p>
<p>
A <dfn variants="primary time zone identifiers" tabindex="-1">primary time zone identifier</dfn> is the preferred identifier for an available named time zone.
A <dfn variants="non-primary time zone identifiers" tabindex="-1">non-primary time zone identifier</dfn> is an identifier for an available named time zone that is not a primary time zone identifier.
An <dfn variants="available named time zone identifiers" tabindex="-1">available named time zone identifier</dfn> is either a primary time zone identifier or a non-primary time zone identifier.
Each available named time zone identifier is associated with exactly one available named time zone.
Each available named time zone is associated with exactly one primary time zone identifier and zero or more non-primary time zone identifiers.
</p>
<p>
ECMAScript implementations must support an available named time zone with the identifier <emu-val>"UTC"</emu-val>, which must be the primary time zone identifier for the UTC time zone.
In addition, implementations may support any number of other available named time zones.
</p>
<p>
Implementations that follow the requirements for time zones as described in the ECMA-402 Internationalization API specification are called <dfn tabindex="-1">time zone aware</dfn>.
Time zone aware implementations must support available named time zones corresponding to the Zone and <emu-xref aoid="Link" id="_ref_10682"><a href="ecmascript-language-scripts-and-modules.html#abstract-link">Link</a></emu-xref> names of the IANA Time Zone Database, and only such names.
In time zone aware implementations, a primary time zone identifier is a Zone name, and a non-primary time zone identifier is a <emu-xref aoid="Link" id="_ref_10683"><a href="ecmascript-language-scripts-and-modules.html#abstract-link">Link</a></emu-xref> name, respectively, in the IANA Time Zone Database except as specifically overridden by <emu-xref aoid="AvailableNamedTimeZoneIdentifiers" id="_ref_10684"><a href="numbers-and-dates.html#sec-availablenamedtimezoneidentifiers">AvailableNamedTimeZoneIdentifiers</a></emu-xref> as specified in the ECMA-402 specification.
Implementations that do not support the entire IANA Time Zone Database are still recommended to use IANA Time Zone Database names as identifiers to represent time zones.
</p>
</emu-clause>
<emu-clause id="sec-getnamedtimezoneepochnanoseconds" type="implementation-defined abstract operation" aoid="GetNamedTimeZoneEpochNanoseconds">
<h1><span class="secnum">21.4.1.20</span> GetNamedTimeZoneEpochNanoseconds ( <var>timeZoneIdentifier</var>, <var>year</var>, <var>month</var>, <var>day</var>, <var>hour</var>, <var>minute</var>, <var>second</var>, <var>millisecond</var>, <var>microsecond</var>, <var>nanosecond</var> )</h1>
<p>The <emu-xref href="#implementation-defined" id="_ref_10685"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> abstract operation GetNamedTimeZoneEpochNanoseconds takes arguments <var>timeZoneIdentifier</var> (a String), <var>year</var> (an <emu-xref href="#integer" id="_ref_10686"><a href="notational-conventions.html#integer">integer</a></emu-xref>), <var>month</var> (an <emu-xref href="#integer" id="_ref_10687"><a href="notational-conventions.html#integer">integer</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10688"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 1 to 12), <var>day</var> (an <emu-xref href="#integer" id="_ref_10689"><a href="notational-conventions.html#integer">integer</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10690"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 1 to 31), <var>hour</var> (an <emu-xref href="#integer" id="_ref_10691"><a href="notational-conventions.html#integer">integer</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10692"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 0 to 23), <var>minute</var> (an <emu-xref href="#integer" id="_ref_10693"><a href="notational-conventions.html#integer">integer</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10694"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 0 to 59), <var>second</var> (an <emu-xref href="#integer" id="_ref_10695"><a href="notational-conventions.html#integer">integer</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10696"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 0 to 59), <var>millisecond</var> (an <emu-xref href="#integer" id="_ref_10697"><a href="notational-conventions.html#integer">integer</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10698"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 0 to 999), <var>microsecond</var> (an <emu-xref href="#integer" id="_ref_10699"><a href="notational-conventions.html#integer">integer</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10700"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 0 to 999), and <var>nanosecond</var> (an <emu-xref href="#integer" id="_ref_10701"><a href="notational-conventions.html#integer">integer</a></emu-xref> in the <emu-xref href="#inclusive-interval" id="_ref_10702"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 0 to 999) and returns a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10703"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of BigInts.
Each value in the returned <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10704"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> represents a number of nanoseconds since the <emu-xref href="#epoch" id="_ref_10705"><a href="numbers-and-dates.html#epoch">epoch</a></emu-xref> that corresponds to the given ISO 8601 calendar date and wall-clock time in the named time zone identified by <var>timeZoneIdentifier</var>.
</p>
<p>
When the input represents a local time occurring more than once because of a negative time zone transition (e.g. when daylight saving time ends or the time zone offset is decreased due to a time zone rule change), the returned <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10706"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> will have more than one element and will be sorted by ascending numerical value.
When the input represents a local time skipped because of a positive time zone transition (e.g. when daylight saving time begins or the time zone offset is increased due to a time zone rule change), the returned <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10707"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> will be empty.
Otherwise, the returned <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10708"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> will have one element.
</p>
<p>The default implementation of GetNamedTimeZoneEpochNanoseconds, to be used for ECMAScript implementations that do not include local political rules for any time zones, performs the following steps when called:</p>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_10709"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>timeZoneIdentifier</var> is <emu-val>"UTC"</emu-val>.</li><li>Let <var>epochNanoseconds</var> be <emu-xref aoid="GetUTCEpochNanoseconds" id="_ref_10710"><a href="numbers-and-dates.html#sec-getutcepochnanoseconds">GetUTCEpochNanoseconds</a></emu-xref>(<var>year</var>, <var>month</var>, <var>day</var>, <var>hour</var>, <var>minute</var>, <var>second</var>, <var>millisecond</var>, <var>microsecond</var>, <var>nanosecond</var>).</li><li>Return « <var>epochNanoseconds</var>&nbsp;».</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>It is required for <emu-xref href="#sec-time-zone-identifiers" id="_ref_10711"><a href="numbers-and-dates.html#sec-time-zone-identifiers">time zone aware</a></emu-xref> implementations (and recommended for all others) to use the time zone information of the IANA Time Zone Database <a href="https://www.iana.org/time-zones/">https://www.iana.org/time-zones/</a>.</p>
<p>1:30 AM on 5 November 2017 in America/New_York is repeated twice, so GetNamedTimeZoneEpochNanoseconds(<emu-val>"America/New_York"</emu-val>, 2017, 11, 5, 1, 30, 0, 0, 0, 0) would return a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10712"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of length 2 in which the first element represents 05:30 UTC (corresponding with 01:30 US Eastern Daylight Time at UTC offset -04:00) and the second element represents 06:30 UTC (corresponding with 01:30 US Eastern Standard Time at UTC offset -05:00).</p>
<p>2:30 AM on 12 March 2017 in America/New_York does not exist, so GetNamedTimeZoneEpochNanoseconds(<emu-val>"America/New_York"</emu-val>, 2017, 3, 12, 2, 30, 0, 0, 0, 0) would return an empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10713"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-getnamedtimezoneoffsetnanoseconds" oldids="sec-local-time-zone-adjustment" type="implementation-defined abstract operation" aoid="GetNamedTimeZoneOffsetNanoseconds"><span id="sec-local-time-zone-adjustment"></span>
<h1><span class="secnum">21.4.1.21</span> GetNamedTimeZoneOffsetNanoseconds ( <var>timeZoneIdentifier</var>, <var>epochNanoseconds</var> )</h1>
<p>The <emu-xref href="#implementation-defined" id="_ref_10714"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> abstract operation GetNamedTimeZoneOffsetNanoseconds takes arguments <var>timeZoneIdentifier</var> (a String) and <var>epochNanoseconds</var> (a BigInt) and returns an <emu-xref href="#integer" id="_ref_10715"><a href="notational-conventions.html#integer">integer</a></emu-xref>.</p>
<p>The returned <emu-xref href="#integer" id="_ref_10716"><a href="notational-conventions.html#integer">integer</a></emu-xref> represents the offset from UTC of the named time zone identified by <var>timeZoneIdentifier</var>, at the instant corresponding with <var>epochNanoseconds</var> relative to the <emu-xref href="#epoch" id="_ref_10717"><a href="numbers-and-dates.html#epoch">epoch</a></emu-xref>, both in nanoseconds.</p>
<p>The default implementation of GetNamedTimeZoneOffsetNanoseconds, to be used for ECMAScript implementations that do not include local political rules for any time zones, performs the following steps when called:</p>
<emu-alg><ol><li><emu-xref href="#assert" id="_ref_10718"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>timeZoneIdentifier</var> is <emu-val>"UTC"</emu-val>.</li><li>Return 0.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>Time zone offset values may be positive or negative.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-time-zone-identifier-record">
<h1><span class="secnum">21.4.1.22</span> Time Zone Identifier Record</h1>
<p>A <dfn variants="Time Zone Identifier Records" tabindex="-1">Time Zone Identifier Record</dfn> is a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10719"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">Record</a></emu-xref> used to describe an <emu-xref href="#sec-time-zone-identifiers" id="_ref_10720"><a href="numbers-and-dates.html#sec-time-zone-identifiers">available named time zone identifier</a></emu-xref> and its corresponding <emu-xref href="#sec-time-zone-identifiers" id="_ref_10721"><a href="numbers-and-dates.html#sec-time-zone-identifiers">primary time zone identifier</a></emu-xref>.</p>
<p>Time Zone Identifier Records have the fields listed in <emu-xref href="#table-time-zone-identifier-record-fields" id="_ref_642"><a href="numbers-and-dates.html#table-time-zone-identifier-record-fields">Table 59</a></emu-xref>.</p>
<emu-table id="table-time-zone-identifier-record-fields" caption="Time Zone Identifier Record Fields"><figure><figcaption>Table 59: <emu-xref href="#sec-time-zone-identifier-record" id="_ref_10722"><a href="numbers-and-dates.html#sec-time-zone-identifier-record">Time Zone Identifier Record</a></emu-xref> Fields</figcaption>
<table>
<thead>
<tr>
<th>Field Name</th>
<th>Value</th>
<th>Meaning</th>
</tr>
</thead>
<tbody><tr>
<td><var class="field">[[Identifier]]</var></td>
<td>a String</td>
<td>An <emu-xref href="#sec-time-zone-identifiers" id="_ref_10723"><a href="numbers-and-dates.html#sec-time-zone-identifiers">available named time zone identifier</a></emu-xref> that is supported by the implementation.</td>
</tr>
<tr>
<td><var class="field">[[PrimaryIdentifier]]</var></td>
<td>a String</td>
<td>The <emu-xref href="#sec-time-zone-identifiers" id="_ref_10724"><a href="numbers-and-dates.html#sec-time-zone-identifiers">primary time zone identifier</a></emu-xref> that <var class="field">[[Identifier]]</var> resolves to.</td>
</tr>
</tbody></table>
</figure></emu-table>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>If <var class="field">[[Identifier]]</var> is a <emu-xref href="#sec-time-zone-identifiers" id="_ref_10725"><a href="numbers-and-dates.html#sec-time-zone-identifiers">primary time zone identifier</a></emu-xref>, then <var class="field">[[Identifier]]</var> is <var class="field">[[PrimaryIdentifier]]</var>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-availablenamedtimezoneidentifiers" type="implementation-defined abstract operation" aoid="AvailableNamedTimeZoneIdentifiers">
<h1><span class="secnum">21.4.1.23</span> AvailableNamedTimeZoneIdentifiers ( )</h1>
<p>The <emu-xref href="#implementation-defined" id="_ref_10726"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> abstract operation AvailableNamedTimeZoneIdentifiers takes no arguments and returns a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10727"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of <emu-xref href="#sec-time-zone-identifier-record" id="_ref_10728"><a href="numbers-and-dates.html#sec-time-zone-identifier-record">Time Zone Identifier Records</a></emu-xref>.
Its result describes all <emu-xref href="#sec-time-zone-identifiers" id="_ref_10729"><a href="numbers-and-dates.html#sec-time-zone-identifiers">available named time zone identifiers</a></emu-xref> in this implementation, as well as the <emu-xref href="#sec-time-zone-identifiers" id="_ref_10730"><a href="numbers-and-dates.html#sec-time-zone-identifiers">primary time zone identifier</a></emu-xref> corresponding to each <emu-xref href="#sec-time-zone-identifiers" id="_ref_10731"><a href="numbers-and-dates.html#sec-time-zone-identifiers">available named time zone identifier</a></emu-xref>.
The <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10732"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> is ordered according to the <var class="field">[[Identifier]]</var> field of each <emu-xref href="#sec-time-zone-identifier-record" id="_ref_10733"><a href="numbers-and-dates.html#sec-time-zone-identifier-record">Time Zone Identifier Record</a></emu-xref>.
</p>
<p>
<emu-xref href="#sec-time-zone-identifiers" id="_ref_10734"><a href="numbers-and-dates.html#sec-time-zone-identifiers">Time zone aware</a></emu-xref> implementations, including all implementations that implement the ECMA-402 Internationalization API, must implement the AvailableNamedTimeZoneIdentifiers abstract operation as specified in the ECMA-402 specification.
For implementations that are not <emu-xref href="#sec-time-zone-identifiers" id="_ref_10735"><a href="numbers-and-dates.html#sec-time-zone-identifiers">time zone aware</a></emu-xref>, AvailableNamedTimeZoneIdentifiers performs the following steps when called:
</p>
<emu-alg><ol><li>If the implementation does not include local political rules for any time zones, then<ol><li>Return « the <emu-xref href="#sec-time-zone-identifier-record" id="_ref_10736"><a href="numbers-and-dates.html#sec-time-zone-identifier-record">Time Zone Identifier Record</a></emu-xref> { <var class="field">[[Identifier]]</var>: <emu-val>"UTC"</emu-val>, <var class="field">[[PrimaryIdentifier]]</var>: <emu-val>"UTC"</emu-val>&nbsp;}&nbsp;».</li></ol></li><li>Let <var>identifiers</var> be the <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10737"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of unique <emu-xref href="#sec-time-zone-identifiers" id="_ref_10738"><a href="numbers-and-dates.html#sec-time-zone-identifiers">available named time zone identifiers</a></emu-xref>, sorted according to <emu-xref href="#lexicographic-code-unit-order" id="_ref_10739"><a href="ecmascript-data-types-and-values.html#lexicographic-code-unit-order">lexicographic code unit order</a></emu-xref>.</li><li>Let <var>result</var> be a new empty <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10740"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref>.</li><li>For each element <var>identifier</var> of <var>identifiers</var>, do<ol><li>Let <var>primary</var> be <var>identifier</var>.</li><li>If <var>identifier</var> is a <emu-xref href="#sec-time-zone-identifiers" id="_ref_10741"><a href="numbers-and-dates.html#sec-time-zone-identifiers">non-primary time zone identifier</a></emu-xref> in this implementation and <var>identifier</var> is not <emu-val>"UTC"</emu-val>, then<ol><li>Set <var>primary</var> to the <emu-xref href="#sec-time-zone-identifiers" id="_ref_10742"><a href="numbers-and-dates.html#sec-time-zone-identifiers">primary time zone identifier</a></emu-xref> associated with <var>identifier</var>.</li><li>NOTE: An implementation may need to resolve <var>identifier</var> iteratively to obtain the <emu-xref href="#sec-time-zone-identifiers" id="_ref_10743"><a href="numbers-and-dates.html#sec-time-zone-identifiers">primary time zone identifier</a></emu-xref>.</li></ol></li><li>Let <var>record</var> be the <emu-xref href="#sec-time-zone-identifier-record" id="_ref_10744"><a href="numbers-and-dates.html#sec-time-zone-identifier-record">Time Zone Identifier Record</a></emu-xref> { <var class="field">[[Identifier]]</var>: <var>identifier</var>, <var class="field">[[PrimaryIdentifier]]</var>: <var>primary</var>&nbsp;}.</li><li>Append <var>record</var> to <var>result</var>.</li></ol></li><li><emu-xref href="#assert" id="_ref_10745"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>result</var> contains a <emu-xref href="#sec-time-zone-identifier-record" id="_ref_10746"><a href="numbers-and-dates.html#sec-time-zone-identifier-record">Time Zone Identifier Record</a></emu-xref> <var>r</var> such that <var>r</var>.<var class="field">[[Identifier]]</var> is <emu-val>"UTC"</emu-val> and <var>r</var>.<var class="field">[[PrimaryIdentifier]]</var> is <emu-val>"UTC"</emu-val>.</li><li>Return <var>result</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-systemtimezoneidentifier" oldids="sec-defaulttimezone" type="implementation-defined abstract operation" aoid="SystemTimeZoneIdentifier"><span id="sec-defaulttimezone"></span>
<h1><span class="secnum">21.4.1.24</span> SystemTimeZoneIdentifier ( )</h1>
<p>The <emu-xref href="#implementation-defined" id="_ref_10747"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> abstract operation SystemTimeZoneIdentifier takes no arguments and returns a String.
It returns a String representing the <emu-xref href="#host-environment" id="_ref_10748"><a href="overview.html#host-environment">host environment</a></emu-xref>'s current time zone, which is either a String representing a UTC offset for which <emu-xref aoid="IsTimeZoneOffsetString" id="_ref_10749"><a href="numbers-and-dates.html#sec-istimezoneoffsetstring">IsTimeZoneOffsetString</a></emu-xref> returns <emu-val>true</emu-val>, or a <emu-xref href="#sec-time-zone-identifiers" id="_ref_10750"><a href="numbers-and-dates.html#sec-time-zone-identifiers">primary time zone identifier</a></emu-xref>.
It performs the following steps when called:</p>
<emu-alg><ol><li>If the implementation only supports the UTC time zone, return <emu-val>"UTC"</emu-val>.</li><li>Let <var>systemTimeZoneString</var> be the String representing the <emu-xref href="#host-environment" id="_ref_10751"><a href="overview.html#host-environment">host environment</a></emu-xref>'s current time zone, either a <emu-xref href="#sec-time-zone-identifiers" id="_ref_10752"><a href="numbers-and-dates.html#sec-time-zone-identifiers">primary time zone identifier</a></emu-xref> or an <emu-xref href="#sec-time-zone-identifiers" id="_ref_10753"><a href="numbers-and-dates.html#sec-time-zone-identifiers">offset time zone</a></emu-xref> identifier.</li><li>Return <var>systemTimeZoneString</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>
To ensure the level of functionality that implementations commonly provide in the methods of the Date object, it is recommended that SystemTimeZoneIdentifier return an IANA time zone name corresponding to the <emu-xref href="#host-environment" id="_ref_10754"><a href="overview.html#host-environment">host environment</a></emu-xref>'s time zone setting, if such a thing exists.
<emu-xref aoid="GetNamedTimeZoneEpochNanoseconds" id="_ref_10755"><a href="numbers-and-dates.html#sec-getnamedtimezoneepochnanoseconds">GetNamedTimeZoneEpochNanoseconds</a></emu-xref> and <emu-xref aoid="GetNamedTimeZoneOffsetNanoseconds" id="_ref_10756"><a href="numbers-and-dates.html#sec-getnamedtimezoneoffsetnanoseconds">GetNamedTimeZoneOffsetNanoseconds</a></emu-xref> must reflect the local political rules for standard time and daylight saving time in that time zone, if such rules exist.
</p>
<p>For example, if the <emu-xref href="#host-environment" id="_ref_10757"><a href="overview.html#host-environment">host environment</a></emu-xref> is a browser on a system where the user has chosen US Eastern Time as their time zone, SystemTimeZoneIdentifier returns <emu-val>"America/New_York"</emu-val>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-localtime" type="abstract operation" aoid="LocalTime">
<h1><span class="secnum">21.4.1.25</span> LocalTime ( <var>t</var> )</h1>
<p>The abstract operation LocalTime takes argument <var>t</var> (a <emu-xref href="#finite" id="_ref_10758"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> <emu-xref href="#sec-time-values-and-time-range" id="_ref_10759"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>) and returns an <emu-xref href="#integral-number" id="_ref_10760"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>.
It converts <var>t</var> from UTC to local time.
The local political rules for standard time and daylight saving time in effect at <var>t</var> should be used to determine the result in the way specified in this section.
It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>systemTimeZoneIdentifier</var> be <emu-xref aoid="SystemTimeZoneIdentifier" id="_ref_10761"><a href="numbers-and-dates.html#sec-systemtimezoneidentifier">SystemTimeZoneIdentifier</a></emu-xref>().</li><li>If <emu-xref aoid="IsTimeZoneOffsetString" id="_ref_10762"><a href="numbers-and-dates.html#sec-istimezoneoffsetstring">IsTimeZoneOffsetString</a></emu-xref>(<var>systemTimeZoneIdentifier</var>) is <emu-val>true</emu-val>, then<ol><li>Let <var>offsetNs</var> be <emu-xref aoid="ParseTimeZoneOffsetString" id="_ref_10763"><a href="numbers-and-dates.html#sec-parsetimezoneoffsetstring">ParseTimeZoneOffsetString</a></emu-xref>(<var>systemTimeZoneIdentifier</var>).</li></ol></li><li>Else,<ol><li>Let <var>offsetNs</var> be <emu-xref aoid="GetNamedTimeZoneOffsetNanoseconds" id="_ref_10764"><a href="numbers-and-dates.html#sec-getnamedtimezoneoffsetnanoseconds">GetNamedTimeZoneOffsetNanoseconds</a></emu-xref>(<var>systemTimeZoneIdentifier</var>, <emu-xref aoid="" id="_ref_10765"><a href="notational-conventions.html#%E2%84%A4"></a></emu-xref>(<emu-xref aoid="" id="_ref_10766"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>t</var>) × 10<sup>6</sup>)).</li></ol></li><li>Let <var>offsetMs</var> be <emu-xref aoid="truncate" id="_ref_10767"><a href="notational-conventions.html#eqn-truncate">truncate</a></emu-xref>(<var>offsetNs</var> / 10<sup>6</sup>).</li><li>Return <var>t</var> + <emu-xref aoid="𝔽" id="_ref_10768"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>offsetMs</var>).</li></ol></emu-alg>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p>If political rules for the local time <var>t</var> are not available within the implementation, the result is <var>t</var> because <emu-xref aoid="SystemTimeZoneIdentifier" id="_ref_10769"><a href="numbers-and-dates.html#sec-systemtimezoneidentifier">SystemTimeZoneIdentifier</a></emu-xref> returns <emu-val>"UTC"</emu-val> and <emu-xref aoid="GetNamedTimeZoneOffsetNanoseconds" id="_ref_10770"><a href="numbers-and-dates.html#sec-getnamedtimezoneoffsetnanoseconds">GetNamedTimeZoneOffsetNanoseconds</a></emu-xref> returns 0.</p>
</div></emu-note>
<emu-note><span class="note">Note 2</span><div class="note-contents">
<p>It is required for <emu-xref href="#sec-time-zone-identifiers" id="_ref_10771"><a href="numbers-and-dates.html#sec-time-zone-identifiers">time zone aware</a></emu-xref> implementations (and recommended for all others) to use the time zone information of the IANA Time Zone Database <a href="https://www.iana.org/time-zones/">https://www.iana.org/time-zones/</a>.</p>
</div></emu-note>
<emu-note><span class="note">Note 3</span><div class="note-contents">
<p>Two different input <emu-xref href="#sec-time-values-and-time-range" id="_ref_10772"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time values</a></emu-xref> <emu-eqn class="inline"><var>t</var><sub>UTC</sub></emu-eqn> are converted to the same local time <emu-eqn class="inline">t<sub>local</sub></emu-eqn> at a negative time zone transition when there are repeated times (e.g. the daylight saving time ends or the time zone adjustment is decreased.).</p>
<p><emu-eqn class="inline">LocalTime(<emu-xref aoid="UTC" id="_ref_10773"><a href="numbers-and-dates.html#sec-utc-t">UTC</a></emu-xref>(<var>t</var><sub>local</sub>))</emu-eqn> is not necessarily always equal to <emu-eqn class="inline"><var>t</var><sub>local</sub></emu-eqn>. Correspondingly, <emu-eqn class="inline"><emu-xref aoid="UTC" id="_ref_10774"><a href="numbers-and-dates.html#sec-utc-t">UTC</a></emu-xref>(LocalTime(<var>t</var><sub>UTC</sub>))</emu-eqn> is not necessarily always equal to <emu-eqn class="inline"><var>t</var><sub>UTC</sub></emu-eqn>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-utc-t" type="abstract operation" aoid="UTC">
<h1><span class="secnum">21.4.1.26</span> UTC ( <var>t</var> )</h1>
<p>The abstract operation UTC takes argument <var>t</var> (a Number) and returns a <emu-xref href="#sec-time-values-and-time-range" id="_ref_10775"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>.
It converts <var>t</var> from local time to a UTC <emu-xref href="#sec-time-values-and-time-range" id="_ref_10776"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>.
The local political rules for standard time and daylight saving time in effect at <var>t</var> should be used to determine the result in the way specified in this section.
It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>t</var> is not <emu-xref href="#finite" id="_ref_10777"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, return <emu-val>NaN</emu-val>.</li><li>Let <var>systemTimeZoneIdentifier</var> be <emu-xref aoid="SystemTimeZoneIdentifier" id="_ref_10778"><a href="numbers-and-dates.html#sec-systemtimezoneidentifier">SystemTimeZoneIdentifier</a></emu-xref>().</li><li>If <emu-xref aoid="IsTimeZoneOffsetString" id="_ref_10779"><a href="numbers-and-dates.html#sec-istimezoneoffsetstring">IsTimeZoneOffsetString</a></emu-xref>(<var>systemTimeZoneIdentifier</var>) is <emu-val>true</emu-val>, then<ol><li>Let <var>offsetNs</var> be <emu-xref aoid="ParseTimeZoneOffsetString" id="_ref_10780"><a href="numbers-and-dates.html#sec-parsetimezoneoffsetstring">ParseTimeZoneOffsetString</a></emu-xref>(<var>systemTimeZoneIdentifier</var>).</li></ol></li><li>Else,<ol><li>Let <var>possibleInstants</var> be <emu-xref aoid="GetNamedTimeZoneEpochNanoseconds" id="_ref_10781"><a href="numbers-and-dates.html#sec-getnamedtimezoneepochnanoseconds">GetNamedTimeZoneEpochNanoseconds</a></emu-xref>(<var>systemTimeZoneIdentifier</var>, <emu-xref aoid="" id="_ref_10782"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="YearFromTime" id="_ref_10783"><a href="numbers-and-dates.html#sec-yearfromtime">YearFromTime</a></emu-xref>(<var>t</var>)), <emu-xref aoid="" id="_ref_10784"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="MonthFromTime" id="_ref_10785"><a href="numbers-and-dates.html#sec-monthfromtime">MonthFromTime</a></emu-xref>(<var>t</var>)) + 1, <emu-xref aoid="" id="_ref_10786"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="DateFromTime" id="_ref_10787"><a href="numbers-and-dates.html#sec-datefromtime">DateFromTime</a></emu-xref>(<var>t</var>)), <emu-xref aoid="" id="_ref_10788"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="HourFromTime" id="_ref_10789"><a href="numbers-and-dates.html#sec-hourfromtime">HourFromTime</a></emu-xref>(<var>t</var>)), <emu-xref aoid="" id="_ref_10790"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="MinFromTime" id="_ref_10791"><a href="numbers-and-dates.html#sec-minfromtime">MinFromTime</a></emu-xref>(<var>t</var>)), <emu-xref aoid="" id="_ref_10792"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="SecFromTime" id="_ref_10793"><a href="numbers-and-dates.html#sec-secfromtime">SecFromTime</a></emu-xref>(<var>t</var>)), <emu-xref aoid="" id="_ref_10794"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="msFromTime" id="_ref_10795"><a href="numbers-and-dates.html#sec-msfromtime">msFromTime</a></emu-xref>(<var>t</var>)), 0, 0).</li><li>NOTE: The following steps ensure that when <var>t</var> represents local time repeating multiple times at a negative time zone transition (e.g. when the daylight saving time ends or the time zone offset is decreased due to a time zone rule change) or skipped local time at a positive time zone transition (e.g. when the daylight saving time starts or the time zone offset is increased due to a time zone rule change), <var>t</var> is interpreted using the time zone offset before the transition.</li><li>If <var>possibleInstants</var> is not empty, then<ol><li>Let <var>disambiguatedInstant</var> be <var>possibleInstants</var>[0].</li></ol></li><li>Else,<ol><li>NOTE: <var>t</var> represents a local time skipped at a positive time zone transition (e.g. due to daylight saving time starting or a time zone rule change increasing the UTC offset).</li><li declared="tBefore">Let <var>possibleInstantsBefore</var> be <emu-xref aoid="GetNamedTimeZoneEpochNanoseconds" id="_ref_10796"><a href="numbers-and-dates.html#sec-getnamedtimezoneepochnanoseconds">GetNamedTimeZoneEpochNanoseconds</a></emu-xref>(<var>systemTimeZoneIdentifier</var>, <emu-xref aoid="" id="_ref_10797"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="YearFromTime" id="_ref_10798"><a href="numbers-and-dates.html#sec-yearfromtime">YearFromTime</a></emu-xref>(<var>tBefore</var>)), <emu-xref aoid="" id="_ref_10799"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="MonthFromTime" id="_ref_10800"><a href="numbers-and-dates.html#sec-monthfromtime">MonthFromTime</a></emu-xref>(<var>tBefore</var>)) + 1, <emu-xref aoid="" id="_ref_10801"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="DateFromTime" id="_ref_10802"><a href="numbers-and-dates.html#sec-datefromtime">DateFromTime</a></emu-xref>(<var>tBefore</var>)), <emu-xref aoid="" id="_ref_10803"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="HourFromTime" id="_ref_10804"><a href="numbers-and-dates.html#sec-hourfromtime">HourFromTime</a></emu-xref>(<var>tBefore</var>)), <emu-xref aoid="" id="_ref_10805"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="MinFromTime" id="_ref_10806"><a href="numbers-and-dates.html#sec-minfromtime">MinFromTime</a></emu-xref>(<var>tBefore</var>)), <emu-xref aoid="" id="_ref_10807"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="SecFromTime" id="_ref_10808"><a href="numbers-and-dates.html#sec-secfromtime">SecFromTime</a></emu-xref>(<var>tBefore</var>)), <emu-xref aoid="" id="_ref_10809"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="msFromTime" id="_ref_10810"><a href="numbers-and-dates.html#sec-msfromtime">msFromTime</a></emu-xref>(<var>tBefore</var>)), 0, 0), where <var>tBefore</var> is the largest <emu-xref href="#integral-number" id="_ref_10811"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> &lt; <var>t</var> for which <var>possibleInstantsBefore</var> is not empty (i.e., <var>tBefore</var> represents the last local time before the transition).</li><li>Let <var>disambiguatedInstant</var> be the last element of <var>possibleInstantsBefore</var>.</li></ol></li><li>Let <var>offsetNs</var> be <emu-xref aoid="GetNamedTimeZoneOffsetNanoseconds" id="_ref_10812"><a href="numbers-and-dates.html#sec-getnamedtimezoneoffsetnanoseconds">GetNamedTimeZoneOffsetNanoseconds</a></emu-xref>(<var>systemTimeZoneIdentifier</var>, <var>disambiguatedInstant</var>).</li></ol></li><li>Let <var>offsetMs</var> be <emu-xref aoid="truncate" id="_ref_10813"><a href="notational-conventions.html#eqn-truncate">truncate</a></emu-xref>(<var>offsetNs</var> / 10<sup>6</sup>).</li><li>Return <var>t</var> - <emu-xref aoid="𝔽" id="_ref_10814"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>offsetMs</var>).</li></ol></emu-alg>
<p>
Input <var>t</var> is nominally a <emu-xref href="#sec-time-values-and-time-range" id="_ref_10815"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref> but may be any Number value.
The algorithm must not limit <var>t</var> to the <emu-xref href="#sec-time-values-and-time-range" id="_ref_10816"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref> range, so that inputs corresponding with a boundary of the <emu-xref href="#sec-time-values-and-time-range" id="_ref_10817"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref> range can be supported regardless of local UTC offset.
For example, the maximum <emu-xref href="#sec-time-values-and-time-range" id="_ref_10818"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref> is 8.64 × 10<sup>15</sup>, corresponding with <emu-val>"+275760-09-13T00:00:00Z"</emu-val>.
In an environment where the local time zone offset is ahead of UTC by 1 hour at that instant, it is represented by the larger input of 8.64 × 10<sup>15</sup> + 3.6 × 10<sup>6</sup>, corresponding with <emu-val>"+275760-09-13T01:00:00+01:00"</emu-val>.
</p>
<p>If political rules for the local time <var>t</var> are not available within the implementation, the result is <var>t</var> because <emu-xref aoid="SystemTimeZoneIdentifier" id="_ref_10819"><a href="numbers-and-dates.html#sec-systemtimezoneidentifier">SystemTimeZoneIdentifier</a></emu-xref> returns <emu-val>"UTC"</emu-val> and <emu-xref aoid="GetNamedTimeZoneOffsetNanoseconds" id="_ref_10820"><a href="numbers-and-dates.html#sec-getnamedtimezoneoffsetnanoseconds">GetNamedTimeZoneOffsetNanoseconds</a></emu-xref> returns 0.</p>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p>It is required for <emu-xref href="#sec-time-zone-identifiers" id="_ref_10821"><a href="numbers-and-dates.html#sec-time-zone-identifiers">time zone aware</a></emu-xref> implementations (and recommended for all others) to use the time zone information of the IANA Time Zone Database <a href="https://www.iana.org/time-zones/">https://www.iana.org/time-zones/</a>.</p>
<p>
1:30 AM on 5 November 2017 in America/New_York is repeated twice (fall backward), but it must be interpreted as 1:30 AM UTC-04 instead of 1:30 AM UTC-05.
In UTC(<emu-xref aoid="TimeClip" id="_ref_10822"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<emu-xref aoid="MakeDate" id="_ref_10823"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="MakeDay" id="_ref_10824"><a href="numbers-and-dates.html#sec-makeday">MakeDay</a></emu-xref>(2017, 10, 5), <emu-xref aoid="MakeTime" id="_ref_10825"><a href="numbers-and-dates.html#sec-maketime">MakeTime</a></emu-xref>(1, 30, 0, 0)))), the value of <var>offsetMs</var> is <emu-eqn class="inline">-4 × <emu-xref aoid="msPerHour" id="_ref_10826"><a href="numbers-and-dates.html#eqn-msPerHour">msPerHour</a></emu-xref></emu-eqn>.
</p>
<p>
2:30 AM on 12 March 2017 in America/New_York does not exist, but it must be interpreted as 2:30 AM UTC-05 (equivalent to 3:30 AM UTC-04).
In UTC(<emu-xref aoid="TimeClip" id="_ref_10827"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<emu-xref aoid="MakeDate" id="_ref_10828"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="MakeDay" id="_ref_10829"><a href="numbers-and-dates.html#sec-makeday">MakeDay</a></emu-xref>(2017, 2, 12), <emu-xref aoid="MakeTime" id="_ref_10830"><a href="numbers-and-dates.html#sec-maketime">MakeTime</a></emu-xref>(2, 30, 0, 0)))), the value of <var>offsetMs</var> is <emu-eqn class="inline">-5 × <emu-xref aoid="msPerHour" id="_ref_10831"><a href="numbers-and-dates.html#eqn-msPerHour">msPerHour</a></emu-xref></emu-eqn>.
</p>
</div></emu-note>
<emu-note><span class="note">Note 2</span><div class="note-contents">
<p><emu-eqn class="inline">UTC(<emu-xref aoid="LocalTime" id="_ref_10832"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>t</var><sub>UTC</sub>))</emu-eqn> is not necessarily always equal to <emu-eqn class="inline"><var>t</var><sub>UTC</sub></emu-eqn>. Correspondingly, <emu-eqn class="inline"><emu-xref aoid="LocalTime" id="_ref_10833"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(UTC(<var>t</var><sub>local</sub>))</emu-eqn> is not necessarily always equal to <emu-eqn class="inline"><var>t</var><sub>local</sub></emu-eqn>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-maketime" type="abstract operation" aoid="MakeTime">
<h1><span class="secnum">21.4.1.27</span> MakeTime ( <var>hour</var>, <var>min</var>, <var>sec</var>, <var>ms</var> )</h1>
<p>The abstract operation MakeTime takes arguments <var>hour</var> (a Number), <var>min</var> (a Number), <var>sec</var> (a Number), and <var>ms</var> (a Number) and returns a Number. It calculates a number of milliseconds. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>hour</var> is not <emu-xref href="#finite" id="_ref_10834"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, <var>min</var> is not <emu-xref href="#finite" id="_ref_10835"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, <var>sec</var> is not <emu-xref href="#finite" id="_ref_10836"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, or <var>ms</var> is not <emu-xref href="#finite" id="_ref_10837"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, return <emu-val>NaN</emu-val>.</li><li>Let <var>h</var> be <emu-xref aoid="𝔽" id="_ref_10838"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(! <emu-xref aoid="ToIntegerOrInfinity" id="_ref_10839"><a href="abstract-operations.html#sec-tointegerorinfinity">ToIntegerOrInfinity</a></emu-xref>(<var>hour</var>)).</li><li>Let <var>m</var> be <emu-xref aoid="𝔽" id="_ref_10840"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(! <emu-xref aoid="ToIntegerOrInfinity" id="_ref_10841"><a href="abstract-operations.html#sec-tointegerorinfinity">ToIntegerOrInfinity</a></emu-xref>(<var>min</var>)).</li><li>Let <var>s</var> be <emu-xref aoid="𝔽" id="_ref_10842"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(! <emu-xref aoid="ToIntegerOrInfinity" id="_ref_10843"><a href="abstract-operations.html#sec-tointegerorinfinity">ToIntegerOrInfinity</a></emu-xref>(<var>sec</var>)).</li><li>Let <var>milli</var> be <emu-xref aoid="𝔽" id="_ref_10844"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(! <emu-xref aoid="ToIntegerOrInfinity" id="_ref_10845"><a href="abstract-operations.html#sec-tointegerorinfinity">ToIntegerOrInfinity</a></emu-xref>(<var>ms</var>)).</li><li>Return ((<var>h</var> × <emu-xref aoid="msPerHour" id="_ref_10846"><a href="numbers-and-dates.html#eqn-msPerHour">msPerHour</a></emu-xref> + <var>m</var> × <emu-xref aoid="msPerMinute" id="_ref_10847"><a href="numbers-and-dates.html#eqn-msPerMinute">msPerMinute</a></emu-xref>) + <var>s</var> × <emu-xref aoid="msPerSecond" id="_ref_10848"><a href="numbers-and-dates.html#eqn-msPerSecond">msPerSecond</a></emu-xref>) + <var>milli</var>.</li></ol></emu-alg>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>The arithmetic in MakeTime is floating-point arithmetic, which is not associative, so the operations must be performed in the correct order.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-makeday" type="abstract operation" aoid="MakeDay">
<h1><span class="secnum">21.4.1.28</span> MakeDay ( <var>year</var>, <var>month</var>, <var>date</var> )</h1>
<p>The abstract operation MakeDay takes arguments <var>year</var> (a Number), <var>month</var> (a Number), and <var>date</var> (a Number) and returns a Number. It calculates a number of days. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>year</var> is not <emu-xref href="#finite" id="_ref_10849"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, <var>month</var> is not <emu-xref href="#finite" id="_ref_10850"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, or <var>date</var> is not <emu-xref href="#finite" id="_ref_10851"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, return <emu-val>NaN</emu-val>.</li><li>Let <var>y</var> be <emu-xref aoid="𝔽" id="_ref_10852"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(! <emu-xref aoid="ToIntegerOrInfinity" id="_ref_10853"><a href="abstract-operations.html#sec-tointegerorinfinity">ToIntegerOrInfinity</a></emu-xref>(<var>year</var>)).</li><li>Let <var>m</var> be <emu-xref aoid="𝔽" id="_ref_10854"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(! <emu-xref aoid="ToIntegerOrInfinity" id="_ref_10855"><a href="abstract-operations.html#sec-tointegerorinfinity">ToIntegerOrInfinity</a></emu-xref>(<var>month</var>)).</li><li>Let <var>dt</var> be <emu-xref aoid="𝔽" id="_ref_10856"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(! <emu-xref aoid="ToIntegerOrInfinity" id="_ref_10857"><a href="abstract-operations.html#sec-tointegerorinfinity">ToIntegerOrInfinity</a></emu-xref>(<var>date</var>)).</li><li>Let <var>ym</var> be <var>y</var> + <emu-xref aoid="𝔽" id="_ref_10858"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<emu-xref aoid="floor" id="_ref_10859"><a href="notational-conventions.html#eqn-floor">floor</a></emu-xref>(<emu-xref aoid="" id="_ref_10860"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>m</var>) / 12)).</li><li>If <var>ym</var> is not <emu-xref href="#finite" id="_ref_10861"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, return <emu-val>NaN</emu-val>.</li><li>Let <var>mn</var> be <emu-xref aoid="𝔽" id="_ref_10862"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<emu-xref aoid="" id="_ref_10863"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>m</var>) <emu-xref aoid="modulo" id="_ref_10864"><a href="notational-conventions.html#eqn-modulo">modulo</a></emu-xref> 12).</li><li>Find a <emu-xref href="#finite" id="_ref_10865"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> <emu-xref href="#sec-time-values-and-time-range" id="_ref_10866"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref> <var>t</var> such that <emu-xref aoid="YearFromTime" id="_ref_10867"><a href="numbers-and-dates.html#sec-yearfromtime">YearFromTime</a></emu-xref>(<var>t</var>) is <var>ym</var>, <emu-xref aoid="MonthFromTime" id="_ref_10868"><a href="numbers-and-dates.html#sec-monthfromtime">MonthFromTime</a></emu-xref>(<var>t</var>) is <var>mn</var>, and <emu-xref aoid="DateFromTime" id="_ref_10869"><a href="numbers-and-dates.html#sec-datefromtime">DateFromTime</a></emu-xref>(<var>t</var>) is <emu-val>1</emu-val><sub>𝔽</sub>; but if this is not possible (because some argument is out of range), return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="Day" id="_ref_10870"><a href="numbers-and-dates.html#sec-day">Day</a></emu-xref>(<var>t</var>) + <var>dt</var> - <emu-val>1</emu-val><sub>𝔽</sub>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-makedate" type="abstract operation" aoid="MakeDate">
<h1><span class="secnum">21.4.1.29</span> MakeDate ( <var>day</var>, <var>time</var> )</h1>
<p>The abstract operation MakeDate takes arguments <var>day</var> (a Number) and <var>time</var> (a Number) and returns a Number. It calculates a number of milliseconds. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>day</var> is not <emu-xref href="#finite" id="_ref_10871"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref> or <var>time</var> is not <emu-xref href="#finite" id="_ref_10872"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, return <emu-val>NaN</emu-val>.</li><li>Let <var>tv</var> be <var>day</var> × <emu-xref aoid="msPerDay" id="_ref_10873"><a href="numbers-and-dates.html#eqn-msPerDay">msPerDay</a></emu-xref> + <var>time</var>.</li><li>If <var>tv</var> is not <emu-xref href="#finite" id="_ref_10874"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, return <emu-val>NaN</emu-val>.</li><li>Return <var>tv</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-makefullyear" type="abstract operation" aoid="MakeFullYear">
<h1><span class="secnum">21.4.1.30</span> MakeFullYear ( <var>year</var> )</h1>
<p>The abstract operation MakeFullYear takes argument <var>year</var> (a Number) and returns an <emu-xref href="#integral-number" id="_ref_10875"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> or <emu-val>NaN</emu-val>. It returns the full year associated with the <emu-xref href="#integer" id="_ref_10876"><a href="notational-conventions.html#integer">integer</a></emu-xref> part of <var>year</var>, interpreting any value in the <emu-xref href="#inclusive-interval" id="_ref_10877"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 0 to 99 as a count of years since the start of 1900. For alignment with the proleptic Gregorian calendar, "full year" is defined as the signed count of complete years since the start of year 0 (1 B.C.). It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>year</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Let <var>truncated</var> be !&nbsp;<emu-xref aoid="ToIntegerOrInfinity" id="_ref_10878"><a href="abstract-operations.html#sec-tointegerorinfinity">ToIntegerOrInfinity</a></emu-xref>(<var>year</var>).</li><li>If <var>truncated</var> is in the <emu-xref href="#inclusive-interval" id="_ref_10879"><a href="notational-conventions.html#inclusive-interval">inclusive interval</a></emu-xref> from 0 to 99, return <emu-val>1900</emu-val><sub>𝔽</sub> + <emu-xref aoid="𝔽" id="_ref_10880"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>truncated</var>).</li><li>Return <emu-xref aoid="𝔽" id="_ref_10881"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<var>truncated</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-timeclip" type="abstract operation" aoid="TimeClip">
<h1><span class="secnum">21.4.1.31</span> TimeClip ( <var>time</var> )</h1>
<p>The abstract operation TimeClip takes argument <var>time</var> (a Number) and returns a Number. It calculates a number of milliseconds. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>time</var> is not <emu-xref href="#finite" id="_ref_10882"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, return <emu-val>NaN</emu-val>.</li><li>If <emu-xref aoid="abs" id="_ref_10883"><a href="notational-conventions.html#eqn-abs">abs</a></emu-xref>(<emu-xref aoid="" id="_ref_10884"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>time</var>)) &gt; 8.64 × 10<sup>15</sup>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="𝔽" id="_ref_10885"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(! <emu-xref aoid="ToIntegerOrInfinity" id="_ref_10886"><a href="abstract-operations.html#sec-tointegerorinfinity">ToIntegerOrInfinity</a></emu-xref>(<var>time</var>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date-time-string-format">
<h1><span class="secnum">21.4.1.32</span> Date Time String Format</h1>
<p>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: <code>YYYY-MM-DDTHH:mm:ss.sssZ</code></p>
<p>Where the elements are as follows:</p>
<figure>
<table class="lightweight-table">
<tbody><tr>
<td>
<code>YYYY</code>
</td>
<td>
is the year in the proleptic Gregorian calendar as four decimal digits from 0000 to 9999, or as an <emu-xref href="#sec-expanded-years" id="_ref_643"><a href="numbers-and-dates.html#sec-expanded-years">expanded year</a></emu-xref> of <emu-val>"+"</emu-val> or <emu-val>"-"</emu-val> followed by six decimal digits.
</td>
</tr>
<tr>
<td>
<code>-</code>
</td>
<td>
<emu-val>"-"</emu-val> (hyphen) appears literally twice in the string.
</td>
</tr>
<tr>
<td>
<code>MM</code>
</td>
<td>
is the month of the year as two decimal digits from 01 (January) to 12 (December).
</td>
</tr>
<tr>
<td>
<code>DD</code>
</td>
<td>
is the day of the month as two decimal digits from 01 to 31.
</td>
</tr>
<tr>
<td>
<code>T</code>
</td>
<td>
<emu-val>"T"</emu-val> appears literally in the string, to indicate the beginning of the time element.
</td>
</tr>
<tr>
<td>
<code>HH</code>
</td>
<td>
is the number of complete hours that have passed since midnight as two decimal digits from 00 to 24.
</td>
</tr>
<tr>
<td>
<code>:</code>
</td>
<td>
<emu-val>":"</emu-val> (colon) appears literally twice in the string.
</td>
</tr>
<tr>
<td>
<code>mm</code>
</td>
<td>
is the number of complete minutes since the start of the hour as two decimal digits from 00 to 59.
</td>
</tr>
<tr>
<td>
<code>ss</code>
</td>
<td>
is the number of complete seconds since the start of the minute as two decimal digits from 00 to 59.
</td>
</tr>
<tr>
<td>
<code>.</code>
</td>
<td>
<emu-val>"."</emu-val> (dot) appears literally in the string.
</td>
</tr>
<tr>
<td>
<code>sss</code>
</td>
<td>
is the number of complete milliseconds since the start of the second as three decimal digits.
</td>
</tr>
<tr>
<td>
<code>Z</code>
</td>
<td>
is the UTC offset representation specified as <emu-val>"Z"</emu-val> (for UTC with no offset) or as either <emu-val>"+"</emu-val> or <emu-val>"-"</emu-val> followed by a time expression <code>HH:mm</code> (a subset of the <emu-xref href="#sec-time-zone-offset-strings" id="_ref_644"><a href="numbers-and-dates.html#sec-time-zone-offset-strings">time zone offset string format</a></emu-xref> for indicating local time ahead of or behind UTC, respectively)
</td>
</tr>
</tbody></table>
</figure>
<p>This format includes date-only forms:</p>
<pre>YYYY
YYYY-MM
YYYY-MM-DD
</pre>
<p>It also includes “date-time” forms that consist of one of the above date-only forms immediately followed by one of the following time forms with an optional UTC offset representation appended:</p>
<pre>THH:mm
THH:mm:ss
THH:mm:ss.sss
</pre>
<p>A string containing out-of-bounds or nonconforming elements is not a valid instance of this format.</p>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p>As every day both starts and ends with midnight, the two notations <code>00:00</code> and <code>24:00</code> are available to distinguish the two midnights that can be associated with one date. This means that the following two notations refer to exactly the same point in time: <code>1995-02-04T24:00</code> and <code>1995-02-05T00:00</code>. This interpretation of the latter form as "end of a calendar day" is consistent with ISO 8601, even though that specification reserves it for describing time intervals and does not permit it within representations of single points in time.</p>
</div></emu-note>
<emu-note><span class="note">Note 2</span><div class="note-contents">
<p>There exists no international standard that specifies abbreviations for civil time zones like CET, EST, etc. and sometimes the same abbreviation is even used for two very different time zones. For this reason, both ISO 8601 and this format specify numeric representations of time zone offsets.</p>
</div></emu-note>
<emu-clause id="sec-expanded-years" oldids="sec-extended-years"><span id="sec-extended-years"></span>
<h1><span class="secnum">21.4.1.32.1</span> Expanded Years</h1>
<p>Covering the full <emu-xref href="#sec-time-values-and-time-range" id="_ref_10887"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref> range of approximately 273,790 years forward or backward from 1 January 1970 (<emu-xref href="#sec-time-values-and-time-range" id="_ref_645"><a href="numbers-and-dates.html#sec-time-values-and-time-range">21.4.1.1</a></emu-xref>) requires representing years before 0 or after 9999. ISO 8601 permits expansion of the year representation, but only by mutual agreement of the partners in information interchange. In the simplified ECMAScript format, such an expanded year representation shall have 6 digits and is always prefixed with a + or - sign. The year 0 is considered positive and must be prefixed with a + sign. The representation of the year 0 as -000000 is invalid. Strings matching the <emu-xref href="#sec-date-time-string-format" id="_ref_646"><a href="numbers-and-dates.html#sec-date-time-string-format">Date Time String Format</a></emu-xref> with expanded years representing instants in time outside the range of a <emu-xref href="#sec-time-values-and-time-range" id="_ref_10888"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref> are treated as unrecognizable by <emu-xref href="#sec-date.parse" id="_ref_647"><a href="numbers-and-dates.html#sec-date.parse"><code>Date.parse</code></a></emu-xref> and cause that function to return <emu-val>NaN</emu-val> without falling back to implementation-specific behaviour or heuristics.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>Examples of date-<emu-not-ref>time values</emu-not-ref> with expanded years:</p>
<figure>
<table class="lightweight-table">
<tbody><tr>
<td>-271821-04-20T00:00:00Z</td>
<td>271822 B.C.</td>
</tr>
<tr>
<td>-000001-01-01T00:00:00Z</td>
<td>2 B.C.</td>
</tr>
<tr>
<td>+000000-01-01T00:00:00Z</td>
<td>1 B.C.</td>
</tr>
<tr>
<td>+000001-01-01T00:00:00Z</td>
<td>1 A.D.</td>
</tr>
<tr>
<td>+001970-01-01T00:00:00Z</td>
<td>1970 A.D.</td>
</tr>
<tr>
<td>+002009-12-15T00:00:00Z</td>
<td>2009 A.D.</td>
</tr>
<tr>
<td>+275760-09-13T00:00:00Z</td>
<td>275760 A.D.</td>
</tr>
</tbody></table>
</figure>
</div></emu-note>
</emu-clause>
</emu-clause>
<emu-clause id="sec-time-zone-offset-strings">
<h1><span class="secnum">21.4.1.33</span> Time Zone Offset String Format</h1>
<p>
ECMAScript defines a string interchange format for UTC offsets, derived from ISO 8601.
The format is described by the following grammar.
</p>
<h2>Syntax</h2>
<emu-grammar type="definition"><emu-production name="UTCOffset" type="regexp" id="prod-UTCOffset">
<emu-nt><a href="numbers-and-dates.html#prod-UTCOffset">UTCOffset</a></emu-nt> <emu-geq>:::</emu-geq> <emu-rhs a="rncvrnaw">
<emu-nt id="_ref_23845"><a href="numbers-and-dates.html#prod-ASCIISign">ASCIISign</a></emu-nt>
<emu-nt id="_ref_23846"><a href="numbers-and-dates.html#prod-Hour">Hour</a></emu-nt>
</emu-rhs>
<emu-rhs a="rr9rer_4">
<emu-nt id="_ref_23847"><a href="numbers-and-dates.html#prod-ASCIISign">ASCIISign</a></emu-nt>
<emu-nt id="_ref_23848"><a href="numbers-and-dates.html#prod-Hour">Hour</a></emu-nt>
<emu-nt params="+Extended" id="_ref_23849"><a href="numbers-and-dates.html#prod-HourSubcomponents">HourSubcomponents</a><emu-mods><emu-params>[+Extended]</emu-params></emu-mods></emu-nt>
</emu-rhs>
<emu-rhs a="gbqmabjo">
<emu-nt id="_ref_23850"><a href="numbers-and-dates.html#prod-ASCIISign">ASCIISign</a></emu-nt>
<emu-nt id="_ref_23851"><a href="numbers-and-dates.html#prod-Hour">Hour</a></emu-nt>
<emu-nt params="~Extended" id="_ref_23852"><a href="numbers-and-dates.html#prod-HourSubcomponents">HourSubcomponents</a><emu-mods><emu-params>[~Extended]</emu-params></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="ASCIISign" type="regexp" oneof="" id="prod-ASCIISign">
<emu-nt><a href="numbers-and-dates.html#prod-ASCIISign">ASCIISign</a></emu-nt> <emu-geq>:::</emu-geq> <emu-oneof>one of</emu-oneof> <emu-rhs><emu-t>+</emu-t> <emu-t>-</emu-t></emu-rhs>
</emu-production>
<emu-production name="Hour" type="regexp" id="prod-Hour">
<emu-nt><a href="numbers-and-dates.html#prod-Hour">Hour</a></emu-nt> <emu-geq>:::</emu-geq> <emu-rhs a="wkfhlj8g">
<emu-t>0</emu-t>
<emu-nt id="_ref_23853"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
</emu-rhs>
<emu-rhs a="5s_tgz36">
<emu-t>1</emu-t>
<emu-nt id="_ref_23854"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
</emu-rhs>
<emu-rhs a="mglsh1s7">
<emu-t>20</emu-t>
</emu-rhs>
<emu-rhs a="u3ktzh-t">
<emu-t>21</emu-t>
</emu-rhs>
<emu-rhs a="vceuvgrv">
<emu-t>22</emu-t>
</emu-rhs>
<emu-rhs a="mvdsu9ue">
<emu-t>23</emu-t>
</emu-rhs>
</emu-production>
<emu-production name="HourSubcomponents" params="Extended" type="regexp" id="prod-HourSubcomponents">
<emu-nt params="Extended"><a href="numbers-and-dates.html#prod-HourSubcomponents">HourSubcomponents</a><emu-mods><emu-params>[Extended]</emu-params></emu-mods></emu-nt> <emu-geq>:::</emu-geq> <emu-rhs a="mxomrswh">
<emu-nt params="?Extended" id="_ref_23855"><a href="numbers-and-dates.html#prod-TimeSeparator">TimeSeparator</a><emu-mods><emu-params>[?Extended]</emu-params></emu-mods></emu-nt>
<emu-nt id="_ref_23856"><a href="numbers-and-dates.html#prod-MinuteSecond">MinuteSecond</a></emu-nt>
</emu-rhs>
<emu-rhs a="zgyah94w">
<emu-nt params="?Extended" id="_ref_23857"><a href="numbers-and-dates.html#prod-TimeSeparator">TimeSeparator</a><emu-mods><emu-params>[?Extended]</emu-params></emu-mods></emu-nt>
<emu-nt id="_ref_23858"><a href="numbers-and-dates.html#prod-MinuteSecond">MinuteSecond</a></emu-nt>
<emu-nt params="?Extended" id="_ref_23859"><a href="numbers-and-dates.html#prod-TimeSeparator">TimeSeparator</a><emu-mods><emu-params>[?Extended]</emu-params></emu-mods></emu-nt>
<emu-nt id="_ref_23860"><a href="numbers-and-dates.html#prod-MinuteSecond">MinuteSecond</a></emu-nt>
<emu-nt optional="" id="_ref_23861"><a href="numbers-and-dates.html#prod-TemporalDecimalFraction">TemporalDecimalFraction</a><emu-mods><emu-opt>opt</emu-opt></emu-mods></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="TimeSeparator" params="Extended" type="regexp" id="prod-TimeSeparator">
<emu-nt params="Extended"><a href="numbers-and-dates.html#prod-TimeSeparator">TimeSeparator</a><emu-mods><emu-params>[Extended]</emu-params></emu-mods></emu-nt> <emu-geq>:::</emu-geq> <emu-rhs a="3wlaayve" constraints="+Extended"><emu-constraints>[+Extended]</emu-constraints>
<emu-t>:</emu-t>
</emu-rhs>
<emu-rhs a="dincvcxf" constraints="~Extended"><emu-constraints>[~Extended]</emu-constraints>
<emu-gann>[empty]</emu-gann>
</emu-rhs>
</emu-production>
<emu-production name="MinuteSecond" type="regexp" id="prod-MinuteSecond">
<emu-nt><a href="numbers-and-dates.html#prod-MinuteSecond">MinuteSecond</a></emu-nt> <emu-geq>:::</emu-geq> <emu-rhs a="wkfhlj8g">
<emu-t>0</emu-t>
<emu-nt id="_ref_23862"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
</emu-rhs>
<emu-rhs a="5s_tgz36">
<emu-t>1</emu-t>
<emu-nt id="_ref_23863"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
</emu-rhs>
<emu-rhs a="lmn5hwr-">
<emu-t>2</emu-t>
<emu-nt id="_ref_23864"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
</emu-rhs>
<emu-rhs a="zu_fwhsh">
<emu-t>3</emu-t>
<emu-nt id="_ref_23865"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
</emu-rhs>
<emu-rhs a="9tumd40b">
<emu-t>4</emu-t>
<emu-nt id="_ref_23866"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
</emu-rhs>
<emu-rhs a="y55tbjay">
<emu-t>5</emu-t>
<emu-nt id="_ref_23867"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="TemporalDecimalFraction" type="regexp" id="prod-TemporalDecimalFraction">
<emu-nt><a href="numbers-and-dates.html#prod-TemporalDecimalFraction">TemporalDecimalFraction</a></emu-nt> <emu-geq>:::</emu-geq> <emu-rhs a="vyuc8izf">
<emu-nt id="_ref_23868"><a href="numbers-and-dates.html#prod-TemporalDecimalSeparator">TemporalDecimalSeparator</a></emu-nt>
<emu-nt id="_ref_23869"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
</emu-rhs>
<emu-rhs a="1rj1uct0">
<emu-nt id="_ref_23870"><a href="numbers-and-dates.html#prod-TemporalDecimalSeparator">TemporalDecimalSeparator</a></emu-nt>
<emu-nt id="_ref_23871"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23872"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
</emu-rhs>
<emu-rhs a="mq72xvpv">
<emu-nt id="_ref_23873"><a href="numbers-and-dates.html#prod-TemporalDecimalSeparator">TemporalDecimalSeparator</a></emu-nt>
<emu-nt id="_ref_23874"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23875"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23876"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
</emu-rhs>
<emu-rhs a="axw3w-zw">
<emu-nt id="_ref_23877"><a href="numbers-and-dates.html#prod-TemporalDecimalSeparator">TemporalDecimalSeparator</a></emu-nt>
<emu-nt id="_ref_23878"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23879"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23880"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23881"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
</emu-rhs>
<emu-rhs a="c1lsnrnq">
<emu-nt id="_ref_23882"><a href="numbers-and-dates.html#prod-TemporalDecimalSeparator">TemporalDecimalSeparator</a></emu-nt>
<emu-nt id="_ref_23883"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23884"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23885"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23886"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23887"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
</emu-rhs>
<emu-rhs a="j1y5dzls">
<emu-nt id="_ref_23888"><a href="numbers-and-dates.html#prod-TemporalDecimalSeparator">TemporalDecimalSeparator</a></emu-nt>
<emu-nt id="_ref_23889"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23890"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23891"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23892"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23893"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23894"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
</emu-rhs>
<emu-rhs a="xrj7td1-">
<emu-nt id="_ref_23895"><a href="numbers-and-dates.html#prod-TemporalDecimalSeparator">TemporalDecimalSeparator</a></emu-nt>
<emu-nt id="_ref_23896"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23897"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23898"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23899"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23900"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23901"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23902"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
</emu-rhs>
<emu-rhs a="pgtcsyep">
<emu-nt id="_ref_23903"><a href="numbers-and-dates.html#prod-TemporalDecimalSeparator">TemporalDecimalSeparator</a></emu-nt>
<emu-nt id="_ref_23904"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23905"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23906"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23907"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23908"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23909"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23910"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23911"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
</emu-rhs>
<emu-rhs a="blsu4l5v">
<emu-nt id="_ref_23912"><a href="numbers-and-dates.html#prod-TemporalDecimalSeparator">TemporalDecimalSeparator</a></emu-nt>
<emu-nt id="_ref_23913"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23914"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23915"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23916"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23917"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23918"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23919"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23920"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
<emu-nt id="_ref_23921"><a href="ecmascript-language-lexical-grammar.html#prod-DecimalDigit">DecimalDigit</a></emu-nt>
</emu-rhs>
</emu-production>
<emu-production name="TemporalDecimalSeparator" type="regexp" oneof="" id="prod-TemporalDecimalSeparator">
<emu-nt><a href="numbers-and-dates.html#prod-TemporalDecimalSeparator">TemporalDecimalSeparator</a></emu-nt> <emu-geq>:::</emu-geq> <emu-oneof>one of</emu-oneof> <emu-rhs><emu-t>.</emu-t> <emu-t>,</emu-t></emu-rhs>
</emu-production>
</emu-grammar>
<emu-clause id="sec-istimezoneoffsetstring" type="abstract operation" aoid="IsTimeZoneOffsetString">
<h1><span class="secnum">21.4.1.33.1</span> IsTimeZoneOffsetString ( <var>offsetString</var> )</h1>
<p>The abstract operation IsTimeZoneOffsetString takes argument <var>offsetString</var> (a String) and returns a Boolean. The return value indicates whether <var>offsetString</var> conforms to the grammar given by <emu-nt id="_ref_23922"><a href="numbers-and-dates.html#prod-UTCOffset">UTCOffset</a></emu-nt>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>parseResult</var> be <emu-xref aoid="ParseText" id="_ref_10889"><a href="ecmascript-language-source-code.html#sec-parsetext">ParseText</a></emu-xref>(<var>offsetString</var>, <emu-nt id="_ref_23923"><a href="numbers-and-dates.html#prod-UTCOffset">UTCOffset</a></emu-nt>).</li><li>If <var>parseResult</var> is a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10890"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of errors, return <emu-val>false</emu-val>.</li><li>Return <emu-val>true</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-parsetimezoneoffsetstring" type="abstract operation" aoid="ParseTimeZoneOffsetString">
<h1><span class="secnum">21.4.1.33.2</span> ParseTimeZoneOffsetString ( <var>offsetString</var> )</h1>
<p>The abstract operation ParseTimeZoneOffsetString takes argument <var>offsetString</var> (a String) and returns an <emu-xref href="#integer" id="_ref_10891"><a href="notational-conventions.html#integer">integer</a></emu-xref>. The return value is the UTC offset, as a number of nanoseconds, that corresponds to the String <var>offsetString</var>. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>parseResult</var> be <emu-xref aoid="ParseText" id="_ref_10892"><a href="ecmascript-language-source-code.html#sec-parsetext">ParseText</a></emu-xref>(<var>offsetString</var>, <emu-nt id="_ref_23924"><a href="numbers-and-dates.html#prod-UTCOffset">UTCOffset</a></emu-nt>).</li><li><emu-xref href="#assert" id="_ref_10893"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>parseResult</var> is not a <emu-xref href="#sec-list-and-record-specification-type" id="_ref_10894"><a href="ecmascript-data-types-and-values.html#sec-list-and-record-specification-type">List</a></emu-xref> of errors.</li><li><emu-xref href="#assert" id="_ref_10895"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>parseResult</var> contains a <emu-nt id="_ref_23925"><a href="numbers-and-dates.html#prod-ASCIISign">ASCIISign</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_10896"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>.</li><li>Let <var>parsedSign</var> be the <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_10897"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">source text matched by</a></emu-xref> the <emu-nt id="_ref_23926"><a href="numbers-and-dates.html#prod-ASCIISign">ASCIISign</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_10898"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref> contained within <var>parseResult</var>.</li><li>If <var>parsedSign</var> is the single code point U+002D (HYPHEN-MINUS), then<ol><li>Let <var>sign</var> be -1.</li></ol></li><li>Else,<ol><li>Let <var>sign</var> be 1.</li></ol></li><li>NOTE: Applications of <emu-xref aoid="StringToNumber" id="_ref_10899"><a href="abstract-operations.html#sec-stringtonumber">StringToNumber</a></emu-xref> below do not lose precision, since each of the parsed values is guaranteed to be a sufficiently short string of decimal digits.</li><li><emu-xref href="#assert" id="_ref_10900"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>parseResult</var> contains an <emu-nt id="_ref_23927"><a href="numbers-and-dates.html#prod-Hour">Hour</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_10901"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>.</li><li>Let <var>parsedHours</var> be the <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_10902"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">source text matched by</a></emu-xref> the <emu-nt id="_ref_23928"><a href="numbers-and-dates.html#prod-Hour">Hour</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_10903"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref> contained within <var>parseResult</var>.</li><li>Let <var>hours</var> be <emu-xref aoid="" id="_ref_10904"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="StringToNumber" id="_ref_10905"><a href="abstract-operations.html#sec-stringtonumber">StringToNumber</a></emu-xref>(<emu-xref aoid="CodePointsToString" id="_ref_10906"><a href="ecmascript-language-source-code.html#sec-codepointstostring">CodePointsToString</a></emu-xref>(<var>parsedHours</var>))).</li><li>If <var>parseResult</var> does not contain a <emu-nt id="_ref_23929"><a href="numbers-and-dates.html#prod-MinuteSecond">MinuteSecond</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_10907"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>, then<ol><li>Let <var>minutes</var> be 0.</li></ol></li><li>Else,<ol><li>Let <var>parsedMinutes</var> be the <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_10908"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">source text matched by</a></emu-xref> the first <emu-nt id="_ref_23930"><a href="numbers-and-dates.html#prod-MinuteSecond">MinuteSecond</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_10909"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref> contained within <var>parseResult</var>.</li><li>Let <var>minutes</var> be <emu-xref aoid="" id="_ref_10910"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="StringToNumber" id="_ref_10911"><a href="abstract-operations.html#sec-stringtonumber">StringToNumber</a></emu-xref>(<emu-xref aoid="CodePointsToString" id="_ref_10912"><a href="ecmascript-language-source-code.html#sec-codepointstostring">CodePointsToString</a></emu-xref>(<var>parsedMinutes</var>))).</li></ol></li><li>If <var>parseResult</var> does not contain two <emu-nt id="_ref_23931"><a href="numbers-and-dates.html#prod-MinuteSecond">MinuteSecond</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_10913"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Nodes</a></emu-xref>, then<ol><li>Let <var>seconds</var> be 0.</li></ol></li><li>Else,<ol><li>Let <var>parsedSeconds</var> be the <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_10914"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">source text matched by</a></emu-xref> the second <emu-nt id="_ref_23932"><a href="numbers-and-dates.html#prod-MinuteSecond">MinuteSecond</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_10915"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref> contained within <var>parseResult</var>.</li><li>Let <var>seconds</var> be <emu-xref aoid="" id="_ref_10916"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="StringToNumber" id="_ref_10917"><a href="abstract-operations.html#sec-stringtonumber">StringToNumber</a></emu-xref>(<emu-xref aoid="CodePointsToString" id="_ref_10918"><a href="ecmascript-language-source-code.html#sec-codepointstostring">CodePointsToString</a></emu-xref>(<var>parsedSeconds</var>))).</li></ol></li><li>If <var>parseResult</var> does not contain a <emu-nt id="_ref_23933"><a href="numbers-and-dates.html#prod-TemporalDecimalFraction">TemporalDecimalFraction</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_10919"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref>, then<ol><li>Let <var>nanoseconds</var> be 0.</li></ol></li><li>Else,<ol><li>Let <var>parsedFraction</var> be the <emu-xref href="#sec-algorithm-conventions-syntax-directed-operations" id="_ref_10920"><a href="notational-conventions.html#sec-algorithm-conventions-syntax-directed-operations">source text matched by</a></emu-xref> the <emu-nt id="_ref_23934"><a href="numbers-and-dates.html#prod-TemporalDecimalFraction">TemporalDecimalFraction</a></emu-nt> <emu-xref href="#sec-syntactic-grammar" id="_ref_10921"><a href="notational-conventions.html#sec-syntactic-grammar">Parse Node</a></emu-xref> contained within <var>parseResult</var>.</li><li>Let <var>fraction</var> be the <emu-xref href="#string-concatenation" id="_ref_10922"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <emu-xref aoid="CodePointsToString" id="_ref_10923"><a href="ecmascript-language-source-code.html#sec-codepointstostring">CodePointsToString</a></emu-xref>(<var>parsedFraction</var>) and <emu-val>"000000000"</emu-val>.</li><li>Let <var>nanosecondsString</var> be the <emu-xref href="#substring" id="_ref_10924"><a href="ecmascript-data-types-and-values.html#substring">substring</a></emu-xref> of <var>fraction</var> from 1 to 10.</li><li>Let <var>nanoseconds</var> be <emu-xref aoid="" id="_ref_10925"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="StringToNumber" id="_ref_10926"><a href="abstract-operations.html#sec-stringtonumber">StringToNumber</a></emu-xref>(<var>nanosecondsString</var>)).</li></ol></li><li>Return <var>sign</var> × (((<var>hours</var> × 60 + <var>minutes</var>) × 60 + <var>seconds</var>) × 10<sup>9</sup> + <var>nanoseconds</var>).</li></ol></emu-alg>
</emu-clause>
</emu-clause>
</emu-clause>
<emu-clause id="sec-date-constructor" oldids="this-time-value,sec-thistimevalue,thistimevalue,this-Date-object"><span id="this-Date-object"></span><span id="thistimevalue"></span><span id="sec-thistimevalue"></span><span id="this-time-value"></span>
<h1><span class="secnum">21.4.2</span> The Date Constructor</h1>
<p>The Date <emu-xref href="#constructor" id="_ref_10927"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>is <dfn tabindex="-1">%Date%</dfn>.</li>
<li>is the initial value of the <emu-val>"Date"</emu-val> property of the <emu-xref href="#sec-global-object" id="_ref_10928"><a href="global-object.html#sec-global-object">global object</a></emu-xref>.</li>
<li>creates and initializes a new Date when called as a <emu-xref href="#constructor" id="_ref_10929"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>.</li>
<li>returns a String representing the current time (UTC) when called as a function rather than as a <emu-xref href="#constructor" id="_ref_10930"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>.</li>
<li>is a function whose behaviour differs based upon the number and types of its arguments.</li>
<li>may be used as the value of an <code>extends</code> clause of a class definition. Subclass <emu-xref href="#constructor" id="_ref_10931"><a href="ecmascript-data-types-and-values.html#constructor">constructors</a></emu-xref> that intend to inherit the specified Date behaviour must include a <code>super</code> call to the Date <emu-xref href="#constructor" id="_ref_10932"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> to create and initialize the subclass instance with a <var class="field">[[DateValue]]</var> internal slot.</li>
</ul>
<emu-clause id="sec-date" oldids="sec-date-constructor-date,sec-date-value,sec-date-year-month-date-hours-minutes-seconds-ms" type="built-in function"><span id="sec-date-year-month-date-hours-minutes-seconds-ms"></span><span id="sec-date-value"></span><span id="sec-date-constructor-date"></span>
<h1><span class="secnum">21.4.2.1</span> Date ( ...<var>values</var> )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>If NewTarget is <emu-val>undefined</emu-val>, then<ol><li>Let <var>now</var> be the <emu-xref href="#sec-time-values-and-time-range" id="_ref_10933"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref> (UTC) identifying the current time.</li><li>Return <emu-xref aoid="ToDateString" id="_ref_10934"><a href="numbers-and-dates.html#sec-todatestring">ToDateString</a></emu-xref>(<var>now</var>).</li></ol></li><li>Let <var>numberOfArgs</var> be the number of elements in <var>values</var>.</li><li>If <var>numberOfArgs</var> = 0, then<ol><li>Let <var>dv</var> be the <emu-xref href="#sec-time-values-and-time-range" id="_ref_10935"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref> (UTC) identifying the current time.</li></ol></li><li>Else if <var>numberOfArgs</var> = 1, then<ol><li>Let <var>value</var> be <var>values</var>[0].</li><li>If <var>value</var> <emu-xref href="#sec-object-type" id="_ref_10936"><a href="ecmascript-data-types-and-values.html#sec-object-type">is an Object</a></emu-xref> and <var>value</var> has a <var class="field">[[DateValue]]</var> internal slot, then<ol><li>Let <var>tv</var> be <var>value</var>.<var class="field">[[DateValue]]</var>.</li></ol></li><li>Else,<ol><li>Let <var>v</var> be ?&nbsp;<emu-xref aoid="ToPrimitive" id="_ref_10937"><a href="abstract-operations.html#sec-toprimitive" class="e-user-code">ToPrimitive</a></emu-xref>(<var>value</var>).</li><li>If <var>v</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_10938"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref>, then<ol><li><emu-xref href="#assert" id="_ref_10939"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: The next step never returns an <emu-xref href="#sec-completion-record-specification-type" id="_ref_10940"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref> because <var>v</var> <emu-xref href="#sec-ecmascript-language-types-string-type" id="_ref_10941"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-string-type">is a String</a></emu-xref>.</li><li>Let <var>tv</var> be the result of parsing <var>v</var> as a date, in exactly the same manner as for the <code>parse</code> method (<emu-xref href="#sec-date.parse" id="_ref_648"><a href="numbers-and-dates.html#sec-date.parse">21.4.3.2</a></emu-xref>).</li></ol></li><li>Else,<ol><li>Let <var>tv</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10942"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>v</var>).</li></ol></li></ol></li><li>Let <var>dv</var> be <emu-xref aoid="TimeClip" id="_ref_10943"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<var>tv</var>).</li></ol></li><li>Else,<ol><li><emu-xref href="#assert" id="_ref_10944"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>numberOfArgs</var> ≥ 2.</li><li>Let <var>y</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10945"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>values</var>[0]).</li><li>Let <var>m</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10946"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>values</var>[1]).</li><li>If <var>numberOfArgs</var> &gt; 2, let <var>dt</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10947"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>values</var>[2]); else let <var>dt</var> be <emu-val>1</emu-val><sub>𝔽</sub>.</li><li>If <var>numberOfArgs</var> &gt; 3, let <var>h</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10948"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>values</var>[3]); else let <var>h</var> be <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>numberOfArgs</var> &gt; 4, let <var>min</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10949"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>values</var>[4]); else let <var>min</var> be <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>numberOfArgs</var> &gt; 5, let <var>s</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10950"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>values</var>[5]); else let <var>s</var> be <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>numberOfArgs</var> &gt; 6, let <var>milli</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10951"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>values</var>[6]); else let <var>milli</var> be <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>Let <var>yr</var> be <emu-xref aoid="MakeFullYear" id="_ref_10952"><a href="numbers-and-dates.html#sec-makefullyear">MakeFullYear</a></emu-xref>(<var>y</var>).</li><li>Let <var>finalDate</var> be <emu-xref aoid="MakeDate" id="_ref_10953"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="MakeDay" id="_ref_10954"><a href="numbers-and-dates.html#sec-makeday">MakeDay</a></emu-xref>(<var>yr</var>, <var>m</var>, <var>dt</var>), <emu-xref aoid="MakeTime" id="_ref_10955"><a href="numbers-and-dates.html#sec-maketime">MakeTime</a></emu-xref>(<var>h</var>, <var>min</var>, <var>s</var>, <var>milli</var>)).</li><li>Let <var>dv</var> be <emu-xref aoid="TimeClip" id="_ref_10956"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<emu-xref aoid="UTC" id="_ref_10957"><a href="numbers-and-dates.html#sec-utc-t">UTC</a></emu-xref>(<var>finalDate</var>)).</li></ol></li><li>Let <var>O</var> be ?&nbsp;<emu-xref aoid="OrdinaryCreateFromConstructor" id="_ref_10958"><a href="ordinary-and-exotic-objects-behaviours.html#sec-ordinarycreatefromconstructor" class="e-user-code">OrdinaryCreateFromConstructor</a></emu-xref>(NewTarget, <emu-val>"%Date.prototype%"</emu-val>, « <var class="field">[[DateValue]]</var>&nbsp;»).</li><li>Set <var>O</var>.<var class="field">[[DateValue]]</var> to <var>dv</var>.</li><li>Return <var>O</var>.</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-date-constructor">
<h1><span class="secnum">21.4.3</span> Properties of the Date Constructor</h1>
<p>The Date <emu-xref href="#constructor" id="_ref_10959"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref>:</p>
<ul>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-function-prototype-object" id="_ref_10960"><a href="fundamental-objects.html#sec-properties-of-the-function-prototype-object">%Function.prototype%</a></emu-xref>.</li>
<li>has a <emu-val>"length"</emu-val> property whose value is <emu-val>7</emu-val><sub>𝔽</sub>.</li>
<li>has the following properties:</li>
</ul>
<emu-clause id="sec-date.now" type="built-in function">
<h1><span class="secnum">21.4.3.1</span> Date.now ( )</h1>
<p>This function returns the <emu-xref href="#sec-time-values-and-time-range" id="_ref_10961"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref> designating the UTC date and time of the occurrence of the call to it.</p>
</emu-clause>
<emu-clause id="sec-date.parse" type="built-in function">
<h1><span class="secnum">21.4.3.2</span> Date.parse ( <var>string</var> )</h1>
<p>This function applies the <emu-xref aoid="ToString" id="_ref_10962"><a href="abstract-operations.html#sec-tostring">ToString</a></emu-xref> operator to its argument. If <emu-xref aoid="ToString" id="_ref_10963"><a href="abstract-operations.html#sec-tostring">ToString</a></emu-xref> results in an <emu-xref href="#sec-completion-record-specification-type" id="_ref_10964"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">abrupt completion</a></emu-xref> the <emu-xref href="#sec-completion-record-specification-type" id="_ref_10965"><a href="ecmascript-data-types-and-values.html#sec-completion-record-specification-type">Completion Record</a></emu-xref> is immediately returned. Otherwise, this function interprets the resulting String as a date and time; it returns a Number, the UTC <emu-xref href="#sec-time-values-and-time-range" id="_ref_10966"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref> corresponding to the date and time. The String may be interpreted as a local time, a UTC time, or a time in some other time zone, depending on the contents of the String. The function first attempts to parse the String according to the format described in Date Time String Format (<emu-xref href="#sec-date-time-string-format" id="_ref_649"><a href="numbers-and-dates.html#sec-date-time-string-format">21.4.1.32</a></emu-xref>), including expanded years. If the String does not conform to that format the function may fall back to any implementation-specific heuristics or implementation-specific date formats. Strings that are unrecognizable or contain out-of-bounds format element values shall cause this function to return <emu-val>NaN</emu-val>.</p>
<p>If the String conforms to the <emu-xref href="#sec-date-time-string-format" id="_ref_650"><a href="numbers-and-dates.html#sec-date-time-string-format">Date Time String Format</a></emu-xref>, substitute values take the place of absent format elements. When the <code>MM</code> or <code>DD</code> elements are absent, <emu-val>"01"</emu-val> is used. When the <code>HH</code>, <code>mm</code>, or <code>ss</code> elements are absent, <emu-val>"00"</emu-val> is used. When the <code>sss</code> element is absent, <emu-val>"000"</emu-val> is used. When the UTC offset representation is absent, date-only forms are interpreted as a UTC time and date-time forms are interpreted as a local time.</p>
<p>If <code>x</code> is any Date whose milliseconds amount is zero within a particular implementation of ECMAScript, then all of the following expressions should produce the same numeric value in that implementation, if all the properties referenced have their initial values:</p>
<pre><code class="javascript hljs">x.<span class="hljs-title function_">valueOf</span>()
<span class="hljs-title class_">Date</span>.<span class="hljs-title function_">parse</span>(x.<span class="hljs-title function_">toString</span>())
<span class="hljs-title class_">Date</span>.<span class="hljs-title function_">parse</span>(x.<span class="hljs-title function_">toUTCString</span>())
<span class="hljs-title class_">Date</span>.<span class="hljs-title function_">parse</span>(x.<span class="hljs-title function_">toISOString</span>())</code></pre>
<p>However, the expression</p>
<pre><code class="javascript hljs"><span class="hljs-title class_">Date</span>.<span class="hljs-title function_">parse</span>(x.<span class="hljs-title function_">toLocaleString</span>())</code></pre>
<p>is not required to produce the same Number value as the preceding three expressions and, in general, the value produced by this function is <emu-xref href="#implementation-defined" id="_ref_10967"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> when given any String value that does not conform to the Date Time String Format (<emu-xref href="#sec-date-time-string-format" id="_ref_651"><a href="numbers-and-dates.html#sec-date-time-string-format">21.4.1.32</a></emu-xref>) and that could not be produced in that implementation by the <code>toString</code> or <code>toUTCString</code> method.</p>
</emu-clause>
<emu-clause id="sec-date.prototype">
<h1><span class="secnum">21.4.3.3</span> Date.prototype</h1>
<p>The initial value of <code>Date.prototype</code> is the <emu-xref href="#sec-properties-of-the-date-prototype-object" id="_ref_10968"><a href="numbers-and-dates.html#sec-properties-of-the-date-prototype-object">Date prototype object</a></emu-xref>.</p>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>false</emu-val> }.</p>
</emu-clause>
<emu-clause id="sec-date.utc" type="built-in function">
<h1><span class="secnum">21.4.3.4</span> Date.UTC ( <var>year</var> [ , <var>month</var> [ , <var>date</var> [ , <var>hours</var> [ , <var>minutes</var> [ , <var>seconds</var> [ , <var>ms</var> ] ] ] ] ] ] )</h1>
<p>This function performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>y</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10969"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>year</var>).</li><li>If <var>month</var> is present, let <var>m</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10970"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>month</var>); else let <var>m</var> be <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>date</var> is present, let <var>dt</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10971"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>date</var>); else let <var>dt</var> be <emu-val>1</emu-val><sub>𝔽</sub>.</li><li>If <var>hours</var> is present, let <var>h</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10972"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>hours</var>); else let <var>h</var> be <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>minutes</var> is present, let <var>min</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10973"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>minutes</var>); else let <var>min</var> be <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>seconds</var> is present, let <var>s</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10974"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>seconds</var>); else let <var>s</var> be <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>If <var>ms</var> is present, let <var>milli</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_10975"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>ms</var>); else let <var>milli</var> be <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>Let <var>yr</var> be <emu-xref aoid="MakeFullYear" id="_ref_10976"><a href="numbers-and-dates.html#sec-makefullyear">MakeFullYear</a></emu-xref>(<var>y</var>).</li><li>Return <emu-xref aoid="TimeClip" id="_ref_10977"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<emu-xref aoid="MakeDate" id="_ref_10978"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="MakeDay" id="_ref_10979"><a href="numbers-and-dates.html#sec-makeday">MakeDay</a></emu-xref>(<var>yr</var>, <var>m</var>, <var>dt</var>), <emu-xref aoid="MakeTime" id="_ref_10980"><a href="numbers-and-dates.html#sec-maketime">MakeTime</a></emu-xref>(<var>h</var>, <var>min</var>, <var>s</var>, <var>milli</var>))).</li></ol></emu-alg>
<p>The <emu-val>"length"</emu-val> property of this function is <emu-val>7</emu-val><sub>𝔽</sub>.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>This function differs from the Date <emu-xref href="#constructor" id="_ref_10981"><a href="ecmascript-data-types-and-values.html#constructor">constructor</a></emu-xref> in two ways: it returns a <emu-xref href="#sec-time-values-and-time-range" id="_ref_10982"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref> as a Number, rather than creating a Date, and it interprets the arguments in UTC rather than as local time.</p>
</div></emu-note>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-the-date-prototype-object">
<h1><span class="secnum">21.4.4</span> Properties of the Date Prototype Object</h1>
<p>The <dfn tabindex="-1">Date prototype object</dfn>:</p>
<ul>
<li>is <dfn tabindex="-1">%Date.prototype%</dfn>.</li>
<li>is itself an <emu-xref href="#ordinary-object" id="_ref_10983"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary object</a></emu-xref>.</li>
<li>is not a Date instance and does not have a <var class="field">[[DateValue]]</var> internal slot.</li>
<li>has a <var class="field">[[Prototype]]</var> internal slot whose value is <emu-xref href="#sec-properties-of-the-object-prototype-object" id="_ref_10984"><a href="fundamental-objects.html#sec-properties-of-the-object-prototype-object">%Object.prototype%</a></emu-xref>.</li>
</ul>
<p>Unless explicitly defined otherwise, the methods of the Date prototype object defined below are not generic and the <emu-val>this</emu-val> value passed to them must be an object that has a <var class="field">[[DateValue]]</var> internal slot that has been initialized to a <emu-xref href="#sec-time-values-and-time-range" id="_ref_10985"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref>.</p>
<emu-clause id="sec-date.prototype.constructor">
<h1><span class="secnum">21.4.4.1</span> Date.prototype.constructor</h1>
<p>The initial value of <code>Date.prototype.constructor</code> is <emu-xref href="#sec-date-constructor" id="_ref_10986"><a href="numbers-and-dates.html#sec-date-constructor">%Date%</a></emu-xref>.</p>
</emu-clause>
<emu-clause id="sec-date.prototype.getdate" type="built-in function">
<h1><span class="secnum">21.4.4.2</span> Date.prototype.getDate ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_10987"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="DateFromTime" id="_ref_10988"><a href="numbers-and-dates.html#sec-datefromtime">DateFromTime</a></emu-xref>(<emu-xref aoid="LocalTime" id="_ref_10989"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>t</var>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.getday" type="built-in function">
<h1><span class="secnum">21.4.4.3</span> Date.prototype.getDay ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_10990"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="WeekDay" id="_ref_10991"><a href="numbers-and-dates.html#sec-weekday">WeekDay</a></emu-xref>(<emu-xref aoid="LocalTime" id="_ref_10992"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>t</var>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.getfullyear" type="built-in function">
<h1><span class="secnum">21.4.4.4</span> Date.prototype.getFullYear ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_10993"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="YearFromTime" id="_ref_10994"><a href="numbers-and-dates.html#sec-yearfromtime">YearFromTime</a></emu-xref>(<emu-xref aoid="LocalTime" id="_ref_10995"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>t</var>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.gethours" type="built-in function">
<h1><span class="secnum">21.4.4.5</span> Date.prototype.getHours ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_10996"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="HourFromTime" id="_ref_10997"><a href="numbers-and-dates.html#sec-hourfromtime">HourFromTime</a></emu-xref>(<emu-xref aoid="LocalTime" id="_ref_10998"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>t</var>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.getmilliseconds" type="built-in function">
<h1><span class="secnum">21.4.4.6</span> Date.prototype.getMilliseconds ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_10999"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="msFromTime" id="_ref_11000"><a href="numbers-and-dates.html#sec-msfromtime">msFromTime</a></emu-xref>(<emu-xref aoid="LocalTime" id="_ref_11001"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>t</var>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.getminutes" type="built-in function">
<h1><span class="secnum">21.4.4.7</span> Date.prototype.getMinutes ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11002"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="MinFromTime" id="_ref_11003"><a href="numbers-and-dates.html#sec-minfromtime">MinFromTime</a></emu-xref>(<emu-xref aoid="LocalTime" id="_ref_11004"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>t</var>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.getmonth" type="built-in function">
<h1><span class="secnum">21.4.4.8</span> Date.prototype.getMonth ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11005"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="MonthFromTime" id="_ref_11006"><a href="numbers-and-dates.html#sec-monthfromtime">MonthFromTime</a></emu-xref>(<emu-xref aoid="LocalTime" id="_ref_11007"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>t</var>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.getseconds" type="built-in function">
<h1><span class="secnum">21.4.4.9</span> Date.prototype.getSeconds ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11008"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="SecFromTime" id="_ref_11009"><a href="numbers-and-dates.html#sec-secfromtime">SecFromTime</a></emu-xref>(<emu-xref aoid="LocalTime" id="_ref_11010"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>t</var>)).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.gettime" type="built-in function">
<h1><span class="secnum">21.4.4.10</span> Date.prototype.getTime ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11011"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Return <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.gettimezoneoffset" type="built-in function">
<h1><span class="secnum">21.4.4.11</span> Date.prototype.getTimezoneOffset ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11012"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Return (<var>t</var> - <emu-xref aoid="LocalTime" id="_ref_11013"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>t</var>)) / <emu-xref aoid="msPerMinute" id="_ref_11014"><a href="numbers-and-dates.html#eqn-msPerMinute">msPerMinute</a></emu-xref>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.getutcdate" type="built-in function">
<h1><span class="secnum">21.4.4.12</span> Date.prototype.getUTCDate ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11015"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="DateFromTime" id="_ref_11016"><a href="numbers-and-dates.html#sec-datefromtime">DateFromTime</a></emu-xref>(<var>t</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.getutcday" type="built-in function">
<h1><span class="secnum">21.4.4.13</span> Date.prototype.getUTCDay ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11017"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="WeekDay" id="_ref_11018"><a href="numbers-and-dates.html#sec-weekday">WeekDay</a></emu-xref>(<var>t</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.getutcfullyear" type="built-in function">
<h1><span class="secnum">21.4.4.14</span> Date.prototype.getUTCFullYear ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11019"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="YearFromTime" id="_ref_11020"><a href="numbers-and-dates.html#sec-yearfromtime">YearFromTime</a></emu-xref>(<var>t</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.getutchours" type="built-in function">
<h1><span class="secnum">21.4.4.15</span> Date.prototype.getUTCHours ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11021"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="HourFromTime" id="_ref_11022"><a href="numbers-and-dates.html#sec-hourfromtime">HourFromTime</a></emu-xref>(<var>t</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.getutcmilliseconds" type="built-in function">
<h1><span class="secnum">21.4.4.16</span> Date.prototype.getUTCMilliseconds ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11023"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="msFromTime" id="_ref_11024"><a href="numbers-and-dates.html#sec-msfromtime">msFromTime</a></emu-xref>(<var>t</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.getutcminutes" type="built-in function">
<h1><span class="secnum">21.4.4.17</span> Date.prototype.getUTCMinutes ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11025"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="MinFromTime" id="_ref_11026"><a href="numbers-and-dates.html#sec-minfromtime">MinFromTime</a></emu-xref>(<var>t</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.getutcmonth" type="built-in function">
<h1><span class="secnum">21.4.4.18</span> Date.prototype.getUTCMonth ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11027"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="MonthFromTime" id="_ref_11028"><a href="numbers-and-dates.html#sec-monthfromtime">MonthFromTime</a></emu-xref>(<var>t</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.getutcseconds" type="built-in function">
<h1><span class="secnum">21.4.4.19</span> Date.prototype.getUTCSeconds ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11029"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Return <emu-xref aoid="SecFromTime" id="_ref_11030"><a href="numbers-and-dates.html#sec-secfromtime">SecFromTime</a></emu-xref>(<var>t</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.setdate" type="built-in function">
<h1><span class="secnum">21.4.4.20</span> Date.prototype.setDate ( <var>date</var> )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11031"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>Let <var>dt</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11032"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>date</var>).</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Set <var>t</var> to <emu-xref aoid="LocalTime" id="_ref_11033"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>t</var>).</li><li>Let <var>newDate</var> be <emu-xref aoid="MakeDate" id="_ref_11034"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="MakeDay" id="_ref_11035"><a href="numbers-and-dates.html#sec-makeday">MakeDay</a></emu-xref>(<emu-xref aoid="YearFromTime" id="_ref_11036"><a href="numbers-and-dates.html#sec-yearfromtime">YearFromTime</a></emu-xref>(<var>t</var>), <emu-xref aoid="MonthFromTime" id="_ref_11037"><a href="numbers-and-dates.html#sec-monthfromtime">MonthFromTime</a></emu-xref>(<var>t</var>), <var>dt</var>), <emu-xref aoid="TimeWithinDay" id="_ref_11038"><a href="numbers-and-dates.html#sec-timewithinday">TimeWithinDay</a></emu-xref>(<var>t</var>)).</li><li>Let <var>u</var> be <emu-xref aoid="TimeClip" id="_ref_11039"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<emu-xref aoid="UTC" id="_ref_11040"><a href="numbers-and-dates.html#sec-utc-t">UTC</a></emu-xref>(<var>newDate</var>)).</li><li>Set <var>dateObject</var>.<var class="field">[[DateValue]]</var> to <var>u</var>.</li><li>Return <var>u</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.setfullyear" type="built-in function">
<h1><span class="secnum">21.4.4.21</span> Date.prototype.setFullYear ( <var>year</var> [ , <var>month</var> [ , <var>date</var> ] ] )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11041"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>Let <var>y</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11042"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>year</var>).</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, set <var>t</var> to <emu-val>+0</emu-val><sub>𝔽</sub>; else set <var>t</var> to <emu-xref aoid="LocalTime" id="_ref_11043"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>t</var>).</li><li>If <var>month</var> is present, let <var>m</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11044"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>month</var>); else let <var>m</var> be <emu-xref aoid="MonthFromTime" id="_ref_11045"><a href="numbers-and-dates.html#sec-monthfromtime">MonthFromTime</a></emu-xref>(<var>t</var>).</li><li>If <var>date</var> is present, let <var>dt</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11046"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>date</var>); else let <var>dt</var> be <emu-xref aoid="DateFromTime" id="_ref_11047"><a href="numbers-and-dates.html#sec-datefromtime">DateFromTime</a></emu-xref>(<var>t</var>).</li><li>Let <var>newDate</var> be <emu-xref aoid="MakeDate" id="_ref_11048"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="MakeDay" id="_ref_11049"><a href="numbers-and-dates.html#sec-makeday">MakeDay</a></emu-xref>(<var>y</var>, <var>m</var>, <var>dt</var>), <emu-xref aoid="TimeWithinDay" id="_ref_11050"><a href="numbers-and-dates.html#sec-timewithinday">TimeWithinDay</a></emu-xref>(<var>t</var>)).</li><li>Let <var>u</var> be <emu-xref aoid="TimeClip" id="_ref_11051"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<emu-xref aoid="UTC" id="_ref_11052"><a href="numbers-and-dates.html#sec-utc-t">UTC</a></emu-xref>(<var>newDate</var>)).</li><li>Set <var>dateObject</var>.<var class="field">[[DateValue]]</var> to <var>u</var>.</li><li>Return <var>u</var>.</li></ol></emu-alg>
<p>The <emu-val>"length"</emu-val> property of this method is <emu-val>3</emu-val><sub>𝔽</sub>.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>If <var>month</var> is not present, this method behaves as if <var>month</var> was present with the value <code>getMonth()</code>. If <var>date</var> is not present, it behaves as if <var>date</var> was present with the value <code>getDate()</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-date.prototype.sethours" type="built-in function">
<h1><span class="secnum">21.4.4.22</span> Date.prototype.setHours ( <var>hour</var> [ , <var>min</var> [ , <var>sec</var> [ , <var>ms</var> ] ] ] )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11053"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>Let <var>h</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11054"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>hour</var>).</li><li>If <var>min</var> is present, let <var>m</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11055"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>min</var>).</li><li>If <var>sec</var> is present, let <var>s</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11056"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>sec</var>).</li><li>If <var>ms</var> is present, let <var>milli</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11057"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>ms</var>).</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Set <var>t</var> to <emu-xref aoid="LocalTime" id="_ref_11058"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>t</var>).</li><li>If <var>min</var> is not present, let <var>m</var> be <emu-xref aoid="MinFromTime" id="_ref_11059"><a href="numbers-and-dates.html#sec-minfromtime">MinFromTime</a></emu-xref>(<var>t</var>).</li><li>If <var>sec</var> is not present, let <var>s</var> be <emu-xref aoid="SecFromTime" id="_ref_11060"><a href="numbers-and-dates.html#sec-secfromtime">SecFromTime</a></emu-xref>(<var>t</var>).</li><li>If <var>ms</var> is not present, let <var>milli</var> be <emu-xref aoid="msFromTime" id="_ref_11061"><a href="numbers-and-dates.html#sec-msfromtime">msFromTime</a></emu-xref>(<var>t</var>).</li><li>Let <var>date</var> be <emu-xref aoid="MakeDate" id="_ref_11062"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="Day" id="_ref_11063"><a href="numbers-and-dates.html#sec-day">Day</a></emu-xref>(<var>t</var>), <emu-xref aoid="MakeTime" id="_ref_11064"><a href="numbers-and-dates.html#sec-maketime">MakeTime</a></emu-xref>(<var>h</var>, <var>m</var>, <var>s</var>, <var>milli</var>)).</li><li>Let <var>u</var> be <emu-xref aoid="TimeClip" id="_ref_11065"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<emu-xref aoid="UTC" id="_ref_11066"><a href="numbers-and-dates.html#sec-utc-t">UTC</a></emu-xref>(<var>date</var>)).</li><li>Set <var>dateObject</var>.<var class="field">[[DateValue]]</var> to <var>u</var>.</li><li>Return <var>u</var>.</li></ol></emu-alg>
<p>The <emu-val>"length"</emu-val> property of this method is <emu-val>4</emu-val><sub>𝔽</sub>.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>If <var>min</var> is not present, this method behaves as if <var>min</var> was present with the value <code>getMinutes()</code>. If <var>sec</var> is not present, it behaves as if <var>sec</var> was present with the value <code>getSeconds()</code>. If <var>ms</var> is not present, it behaves as if <var>ms</var> was present with the value <code>getMilliseconds()</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-date.prototype.setmilliseconds" type="built-in function">
<h1><span class="secnum">21.4.4.23</span> Date.prototype.setMilliseconds ( <var>ms</var> )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11067"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>Set <var>ms</var> to ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11068"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>ms</var>).</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Set <var>t</var> to <emu-xref aoid="LocalTime" id="_ref_11069"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>t</var>).</li><li>Let <var>time</var> be <emu-xref aoid="MakeTime" id="_ref_11070"><a href="numbers-and-dates.html#sec-maketime">MakeTime</a></emu-xref>(<emu-xref aoid="HourFromTime" id="_ref_11071"><a href="numbers-and-dates.html#sec-hourfromtime">HourFromTime</a></emu-xref>(<var>t</var>), <emu-xref aoid="MinFromTime" id="_ref_11072"><a href="numbers-and-dates.html#sec-minfromtime">MinFromTime</a></emu-xref>(<var>t</var>), <emu-xref aoid="SecFromTime" id="_ref_11073"><a href="numbers-and-dates.html#sec-secfromtime">SecFromTime</a></emu-xref>(<var>t</var>), <var>ms</var>).</li><li>Let <var>u</var> be <emu-xref aoid="TimeClip" id="_ref_11074"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<emu-xref aoid="UTC" id="_ref_11075"><a href="numbers-and-dates.html#sec-utc-t">UTC</a></emu-xref>(<emu-xref aoid="MakeDate" id="_ref_11076"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="Day" id="_ref_11077"><a href="numbers-and-dates.html#sec-day">Day</a></emu-xref>(<var>t</var>), <var>time</var>))).</li><li>Set <var>dateObject</var>.<var class="field">[[DateValue]]</var> to <var>u</var>.</li><li>Return <var>u</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.setminutes" type="built-in function">
<h1><span class="secnum">21.4.4.24</span> Date.prototype.setMinutes ( <var>min</var> [ , <var>sec</var> [ , <var>ms</var> ] ] )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11078"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>Let <var>m</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11079"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>min</var>).</li><li>If <var>sec</var> is present, let <var>s</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11080"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>sec</var>).</li><li>If <var>ms</var> is present, let <var>milli</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11081"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>ms</var>).</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Set <var>t</var> to <emu-xref aoid="LocalTime" id="_ref_11082"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>t</var>).</li><li>If <var>sec</var> is not present, let <var>s</var> be <emu-xref aoid="SecFromTime" id="_ref_11083"><a href="numbers-and-dates.html#sec-secfromtime">SecFromTime</a></emu-xref>(<var>t</var>).</li><li>If <var>ms</var> is not present, let <var>milli</var> be <emu-xref aoid="msFromTime" id="_ref_11084"><a href="numbers-and-dates.html#sec-msfromtime">msFromTime</a></emu-xref>(<var>t</var>).</li><li>Let <var>date</var> be <emu-xref aoid="MakeDate" id="_ref_11085"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="Day" id="_ref_11086"><a href="numbers-and-dates.html#sec-day">Day</a></emu-xref>(<var>t</var>), <emu-xref aoid="MakeTime" id="_ref_11087"><a href="numbers-and-dates.html#sec-maketime">MakeTime</a></emu-xref>(<emu-xref aoid="HourFromTime" id="_ref_11088"><a href="numbers-and-dates.html#sec-hourfromtime">HourFromTime</a></emu-xref>(<var>t</var>), <var>m</var>, <var>s</var>, <var>milli</var>)).</li><li>Let <var>u</var> be <emu-xref aoid="TimeClip" id="_ref_11089"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<emu-xref aoid="UTC" id="_ref_11090"><a href="numbers-and-dates.html#sec-utc-t">UTC</a></emu-xref>(<var>date</var>)).</li><li>Set <var>dateObject</var>.<var class="field">[[DateValue]]</var> to <var>u</var>.</li><li>Return <var>u</var>.</li></ol></emu-alg>
<p>The <emu-val>"length"</emu-val> property of this method is <emu-val>3</emu-val><sub>𝔽</sub>.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>If <var>sec</var> is not present, this method behaves as if <var>sec</var> was present with the value <code>getSeconds()</code>. If <var>ms</var> is not present, this behaves as if <var>ms</var> was present with the value <code>getMilliseconds()</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-date.prototype.setmonth" type="built-in function">
<h1><span class="secnum">21.4.4.25</span> Date.prototype.setMonth ( <var>month</var> [ , <var>date</var> ] )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11091"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>Let <var>m</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11092"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>month</var>).</li><li>If <var>date</var> is present, let <var>dt</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11093"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>date</var>).</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Set <var>t</var> to <emu-xref aoid="LocalTime" id="_ref_11094"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>t</var>).</li><li>If <var>date</var> is not present, let <var>dt</var> be <emu-xref aoid="DateFromTime" id="_ref_11095"><a href="numbers-and-dates.html#sec-datefromtime">DateFromTime</a></emu-xref>(<var>t</var>).</li><li>Let <var>newDate</var> be <emu-xref aoid="MakeDate" id="_ref_11096"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="MakeDay" id="_ref_11097"><a href="numbers-and-dates.html#sec-makeday">MakeDay</a></emu-xref>(<emu-xref aoid="YearFromTime" id="_ref_11098"><a href="numbers-and-dates.html#sec-yearfromtime">YearFromTime</a></emu-xref>(<var>t</var>), <var>m</var>, <var>dt</var>), <emu-xref aoid="TimeWithinDay" id="_ref_11099"><a href="numbers-and-dates.html#sec-timewithinday">TimeWithinDay</a></emu-xref>(<var>t</var>)).</li><li>Let <var>u</var> be <emu-xref aoid="TimeClip" id="_ref_11100"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<emu-xref aoid="UTC" id="_ref_11101"><a href="numbers-and-dates.html#sec-utc-t">UTC</a></emu-xref>(<var>newDate</var>)).</li><li>Set <var>dateObject</var>.<var class="field">[[DateValue]]</var> to <var>u</var>.</li><li>Return <var>u</var>.</li></ol></emu-alg>
<p>The <emu-val>"length"</emu-val> property of this method is <emu-val>2</emu-val><sub>𝔽</sub>.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>If <var>date</var> is not present, this method behaves as if <var>date</var> was present with the value <code>getDate()</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-date.prototype.setseconds" type="built-in function">
<h1><span class="secnum">21.4.4.26</span> Date.prototype.setSeconds ( <var>sec</var> [ , <var>ms</var> ] )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11102"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>Let <var>s</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11103"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>sec</var>).</li><li>If <var>ms</var> is present, let <var>milli</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11104"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>ms</var>).</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Set <var>t</var> to <emu-xref aoid="LocalTime" id="_ref_11105"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>t</var>).</li><li>If <var>ms</var> is not present, let <var>milli</var> be <emu-xref aoid="msFromTime" id="_ref_11106"><a href="numbers-and-dates.html#sec-msfromtime">msFromTime</a></emu-xref>(<var>t</var>).</li><li>Let <var>date</var> be <emu-xref aoid="MakeDate" id="_ref_11107"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="Day" id="_ref_11108"><a href="numbers-and-dates.html#sec-day">Day</a></emu-xref>(<var>t</var>), <emu-xref aoid="MakeTime" id="_ref_11109"><a href="numbers-and-dates.html#sec-maketime">MakeTime</a></emu-xref>(<emu-xref aoid="HourFromTime" id="_ref_11110"><a href="numbers-and-dates.html#sec-hourfromtime">HourFromTime</a></emu-xref>(<var>t</var>), <emu-xref aoid="MinFromTime" id="_ref_11111"><a href="numbers-and-dates.html#sec-minfromtime">MinFromTime</a></emu-xref>(<var>t</var>), <var>s</var>, <var>milli</var>)).</li><li>Let <var>u</var> be <emu-xref aoid="TimeClip" id="_ref_11112"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<emu-xref aoid="UTC" id="_ref_11113"><a href="numbers-and-dates.html#sec-utc-t">UTC</a></emu-xref>(<var>date</var>)).</li><li>Set <var>dateObject</var>.<var class="field">[[DateValue]]</var> to <var>u</var>.</li><li>Return <var>u</var>.</li></ol></emu-alg>
<p>The <emu-val>"length"</emu-val> property of this method is <emu-val>2</emu-val><sub>𝔽</sub>.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>If <var>ms</var> is not present, this method behaves as if <var>ms</var> was present with the value <code>getMilliseconds()</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-date.prototype.settime" type="built-in function">
<h1><span class="secnum">21.4.4.27</span> Date.prototype.setTime ( <var>time</var> )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11114"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11115"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>time</var>).</li><li>Let <var>v</var> be <emu-xref aoid="TimeClip" id="_ref_11116"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<var>t</var>).</li><li>Set <var>dateObject</var>.<var class="field">[[DateValue]]</var> to <var>v</var>.</li><li>Return <var>v</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.setutcdate" type="built-in function">
<h1><span class="secnum">21.4.4.28</span> Date.prototype.setUTCDate ( <var>date</var> )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11117"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>Let <var>dt</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11118"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>date</var>).</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Let <var>newDate</var> be <emu-xref aoid="MakeDate" id="_ref_11119"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="MakeDay" id="_ref_11120"><a href="numbers-and-dates.html#sec-makeday">MakeDay</a></emu-xref>(<emu-xref aoid="YearFromTime" id="_ref_11121"><a href="numbers-and-dates.html#sec-yearfromtime">YearFromTime</a></emu-xref>(<var>t</var>), <emu-xref aoid="MonthFromTime" id="_ref_11122"><a href="numbers-and-dates.html#sec-monthfromtime">MonthFromTime</a></emu-xref>(<var>t</var>), <var>dt</var>), <emu-xref aoid="TimeWithinDay" id="_ref_11123"><a href="numbers-and-dates.html#sec-timewithinday">TimeWithinDay</a></emu-xref>(<var>t</var>)).</li><li>Let <var>v</var> be <emu-xref aoid="TimeClip" id="_ref_11124"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<var>newDate</var>).</li><li>Set <var>dateObject</var>.<var class="field">[[DateValue]]</var> to <var>v</var>.</li><li>Return <var>v</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.setutcfullyear" type="built-in function">
<h1><span class="secnum">21.4.4.29</span> Date.prototype.setUTCFullYear ( <var>year</var> [ , <var>month</var> [ , <var>date</var> ] ] )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11125"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, set <var>t</var> to <emu-val>+0</emu-val><sub>𝔽</sub>.</li><li>Let <var>y</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11126"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>year</var>).</li><li>If <var>month</var> is present, let <var>m</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11127"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>month</var>); else let <var>m</var> be <emu-xref aoid="MonthFromTime" id="_ref_11128"><a href="numbers-and-dates.html#sec-monthfromtime">MonthFromTime</a></emu-xref>(<var>t</var>).</li><li>If <var>date</var> is present, let <var>dt</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11129"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>date</var>); else let <var>dt</var> be <emu-xref aoid="DateFromTime" id="_ref_11130"><a href="numbers-and-dates.html#sec-datefromtime">DateFromTime</a></emu-xref>(<var>t</var>).</li><li>Let <var>newDate</var> be <emu-xref aoid="MakeDate" id="_ref_11131"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="MakeDay" id="_ref_11132"><a href="numbers-and-dates.html#sec-makeday">MakeDay</a></emu-xref>(<var>y</var>, <var>m</var>, <var>dt</var>), <emu-xref aoid="TimeWithinDay" id="_ref_11133"><a href="numbers-and-dates.html#sec-timewithinday">TimeWithinDay</a></emu-xref>(<var>t</var>)).</li><li>Let <var>v</var> be <emu-xref aoid="TimeClip" id="_ref_11134"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<var>newDate</var>).</li><li>Set <var>dateObject</var>.<var class="field">[[DateValue]]</var> to <var>v</var>.</li><li>Return <var>v</var>.</li></ol></emu-alg>
<p>The <emu-val>"length"</emu-val> property of this method is <emu-val>3</emu-val><sub>𝔽</sub>.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>If <var>month</var> is not present, this method behaves as if <var>month</var> was present with the value <code>getUTCMonth()</code>. If <var>date</var> is not present, it behaves as if <var>date</var> was present with the value <code>getUTCDate()</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-date.prototype.setutchours" type="built-in function">
<h1><span class="secnum">21.4.4.30</span> Date.prototype.setUTCHours ( <var>hour</var> [ , <var>min</var> [ , <var>sec</var> [ , <var>ms</var> ] ] ] )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11135"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>Let <var>h</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11136"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>hour</var>).</li><li>If <var>min</var> is present, let <var>m</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11137"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>min</var>).</li><li>If <var>sec</var> is present, let <var>s</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11138"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>sec</var>).</li><li>If <var>ms</var> is present, let <var>milli</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11139"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>ms</var>).</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>If <var>min</var> is not present, let <var>m</var> be <emu-xref aoid="MinFromTime" id="_ref_11140"><a href="numbers-and-dates.html#sec-minfromtime">MinFromTime</a></emu-xref>(<var>t</var>).</li><li>If <var>sec</var> is not present, let <var>s</var> be <emu-xref aoid="SecFromTime" id="_ref_11141"><a href="numbers-and-dates.html#sec-secfromtime">SecFromTime</a></emu-xref>(<var>t</var>).</li><li>If <var>ms</var> is not present, let <var>milli</var> be <emu-xref aoid="msFromTime" id="_ref_11142"><a href="numbers-and-dates.html#sec-msfromtime">msFromTime</a></emu-xref>(<var>t</var>).</li><li>Let <var>date</var> be <emu-xref aoid="MakeDate" id="_ref_11143"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="Day" id="_ref_11144"><a href="numbers-and-dates.html#sec-day">Day</a></emu-xref>(<var>t</var>), <emu-xref aoid="MakeTime" id="_ref_11145"><a href="numbers-and-dates.html#sec-maketime">MakeTime</a></emu-xref>(<var>h</var>, <var>m</var>, <var>s</var>, <var>milli</var>)).</li><li>Let <var>v</var> be <emu-xref aoid="TimeClip" id="_ref_11146"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<var>date</var>).</li><li>Set <var>dateObject</var>.<var class="field">[[DateValue]]</var> to <var>v</var>.</li><li>Return <var>v</var>.</li></ol></emu-alg>
<p>The <emu-val>"length"</emu-val> property of this method is <emu-val>4</emu-val><sub>𝔽</sub>.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>If <var>min</var> is not present, this method behaves as if <var>min</var> was present with the value <code>getUTCMinutes()</code>. If <var>sec</var> is not present, it behaves as if <var>sec</var> was present with the value <code>getUTCSeconds()</code>. If <var>ms</var> is not present, it behaves as if <var>ms</var> was present with the value <code>getUTCMilliseconds()</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-date.prototype.setutcmilliseconds" type="built-in function">
<h1><span class="secnum">21.4.4.31</span> Date.prototype.setUTCMilliseconds ( <var>ms</var> )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11147"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>Set <var>ms</var> to ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11148"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>ms</var>).</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>Let <var>time</var> be <emu-xref aoid="MakeTime" id="_ref_11149"><a href="numbers-and-dates.html#sec-maketime">MakeTime</a></emu-xref>(<emu-xref aoid="HourFromTime" id="_ref_11150"><a href="numbers-and-dates.html#sec-hourfromtime">HourFromTime</a></emu-xref>(<var>t</var>), <emu-xref aoid="MinFromTime" id="_ref_11151"><a href="numbers-and-dates.html#sec-minfromtime">MinFromTime</a></emu-xref>(<var>t</var>), <emu-xref aoid="SecFromTime" id="_ref_11152"><a href="numbers-and-dates.html#sec-secfromtime">SecFromTime</a></emu-xref>(<var>t</var>), <var>ms</var>).</li><li>Let <var>v</var> be <emu-xref aoid="TimeClip" id="_ref_11153"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<emu-xref aoid="MakeDate" id="_ref_11154"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="Day" id="_ref_11155"><a href="numbers-and-dates.html#sec-day">Day</a></emu-xref>(<var>t</var>), <var>time</var>)).</li><li>Set <var>dateObject</var>.<var class="field">[[DateValue]]</var> to <var>v</var>.</li><li>Return <var>v</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.setutcminutes" type="built-in function">
<h1><span class="secnum">21.4.4.32</span> Date.prototype.setUTCMinutes ( <var>min</var> [ , <var>sec</var> [ , <var>ms</var> ] ] )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11156"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>Let <var>m</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11157"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>min</var>).</li><li>If <var>sec</var> is present, let <var>s</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11158"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>sec</var>).</li><li>If <var>ms</var> is present, let <var>milli</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11159"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>ms</var>).</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>If <var>sec</var> is not present, let <var>s</var> be <emu-xref aoid="SecFromTime" id="_ref_11160"><a href="numbers-and-dates.html#sec-secfromtime">SecFromTime</a></emu-xref>(<var>t</var>).</li><li>If <var>ms</var> is not present, let <var>milli</var> be <emu-xref aoid="msFromTime" id="_ref_11161"><a href="numbers-and-dates.html#sec-msfromtime">msFromTime</a></emu-xref>(<var>t</var>).</li><li>Let <var>date</var> be <emu-xref aoid="MakeDate" id="_ref_11162"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="Day" id="_ref_11163"><a href="numbers-and-dates.html#sec-day">Day</a></emu-xref>(<var>t</var>), <emu-xref aoid="MakeTime" id="_ref_11164"><a href="numbers-and-dates.html#sec-maketime">MakeTime</a></emu-xref>(<emu-xref aoid="HourFromTime" id="_ref_11165"><a href="numbers-and-dates.html#sec-hourfromtime">HourFromTime</a></emu-xref>(<var>t</var>), <var>m</var>, <var>s</var>, <var>milli</var>)).</li><li>Let <var>v</var> be <emu-xref aoid="TimeClip" id="_ref_11166"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<var>date</var>).</li><li>Set <var>dateObject</var>.<var class="field">[[DateValue]]</var> to <var>v</var>.</li><li>Return <var>v</var>.</li></ol></emu-alg>
<p>The <emu-val>"length"</emu-val> property of this method is <emu-val>3</emu-val><sub>𝔽</sub>.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>If <var>sec</var> is not present, this method behaves as if <var>sec</var> was present with the value <code>getUTCSeconds()</code>. If <var>ms</var> is not present, it behaves as if <var>ms</var> was present with the value return by <code>getUTCMilliseconds()</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-date.prototype.setutcmonth" type="built-in function">
<h1><span class="secnum">21.4.4.33</span> Date.prototype.setUTCMonth ( <var>month</var> [ , <var>date</var> ] )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11167"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>Let <var>m</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11168"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>month</var>).</li><li>If <var>date</var> is present, let <var>dt</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11169"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>date</var>).</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>If <var>date</var> is not present, let <var>dt</var> be <emu-xref aoid="DateFromTime" id="_ref_11170"><a href="numbers-and-dates.html#sec-datefromtime">DateFromTime</a></emu-xref>(<var>t</var>).</li><li>Let <var>newDate</var> be <emu-xref aoid="MakeDate" id="_ref_11171"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="MakeDay" id="_ref_11172"><a href="numbers-and-dates.html#sec-makeday">MakeDay</a></emu-xref>(<emu-xref aoid="YearFromTime" id="_ref_11173"><a href="numbers-and-dates.html#sec-yearfromtime">YearFromTime</a></emu-xref>(<var>t</var>), <var>m</var>, <var>dt</var>), <emu-xref aoid="TimeWithinDay" id="_ref_11174"><a href="numbers-and-dates.html#sec-timewithinday">TimeWithinDay</a></emu-xref>(<var>t</var>)).</li><li>Let <var>v</var> be <emu-xref aoid="TimeClip" id="_ref_11175"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<var>newDate</var>).</li><li>Set <var>dateObject</var>.<var class="field">[[DateValue]]</var> to <var>v</var>.</li><li>Return <var>v</var>.</li></ol></emu-alg>
<p>The <emu-val>"length"</emu-val> property of this method is <emu-val>2</emu-val><sub>𝔽</sub>.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>If <var>date</var> is not present, this method behaves as if <var>date</var> was present with the value <code>getUTCDate()</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-date.prototype.setutcseconds" type="built-in function">
<h1><span class="secnum">21.4.4.34</span> Date.prototype.setUTCSeconds ( <var>sec</var> [ , <var>ms</var> ] )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11176"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>t</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>Let <var>s</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11177"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>sec</var>).</li><li>If <var>ms</var> is present, let <var>milli</var> be ?&nbsp;<emu-xref aoid="ToNumber" id="_ref_11178"><a href="abstract-operations.html#sec-tonumber" class="e-user-code">ToNumber</a></emu-xref>(<var>ms</var>).</li><li>If <var>t</var> is <emu-val>NaN</emu-val>, return <emu-val>NaN</emu-val>.</li><li>If <var>ms</var> is not present, let <var>milli</var> be <emu-xref aoid="msFromTime" id="_ref_11179"><a href="numbers-and-dates.html#sec-msfromtime">msFromTime</a></emu-xref>(<var>t</var>).</li><li>Let <var>date</var> be <emu-xref aoid="MakeDate" id="_ref_11180"><a href="numbers-and-dates.html#sec-makedate">MakeDate</a></emu-xref>(<emu-xref aoid="Day" id="_ref_11181"><a href="numbers-and-dates.html#sec-day">Day</a></emu-xref>(<var>t</var>), <emu-xref aoid="MakeTime" id="_ref_11182"><a href="numbers-and-dates.html#sec-maketime">MakeTime</a></emu-xref>(<emu-xref aoid="HourFromTime" id="_ref_11183"><a href="numbers-and-dates.html#sec-hourfromtime">HourFromTime</a></emu-xref>(<var>t</var>), <emu-xref aoid="MinFromTime" id="_ref_11184"><a href="numbers-and-dates.html#sec-minfromtime">MinFromTime</a></emu-xref>(<var>t</var>), <var>s</var>, <var>milli</var>)).</li><li>Let <var>v</var> be <emu-xref aoid="TimeClip" id="_ref_11185"><a href="numbers-and-dates.html#sec-timeclip">TimeClip</a></emu-xref>(<var>date</var>).</li><li>Set <var>dateObject</var>.<var class="field">[[DateValue]]</var> to <var>v</var>.</li><li>Return <var>v</var>.</li></ol></emu-alg>
<p>The <emu-val>"length"</emu-val> property of this method is <emu-val>2</emu-val><sub>𝔽</sub>.</p>
<emu-note><span class="note">Note</span><div class="note-contents">
<p>If <var>ms</var> is not present, this method behaves as if <var>ms</var> was present with the value <code>getUTCMilliseconds()</code>.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-date.prototype.todatestring" type="built-in function">
<h1><span class="secnum">21.4.4.35</span> Date.prototype.toDateString ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11186"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>tv</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>tv</var> is <emu-val>NaN</emu-val>, return <emu-val>"Invalid Date"</emu-val>.</li><li>Let <var>t</var> be <emu-xref aoid="LocalTime" id="_ref_11187"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>tv</var>).</li><li>Return <emu-xref aoid="DateString" id="_ref_11188"><a href="numbers-and-dates.html#sec-datestring">DateString</a></emu-xref>(<var>t</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.toisostring" type="built-in function">
<h1><span class="secnum">21.4.4.36</span> Date.prototype.toISOString ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11189"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>tv</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>tv</var> is <emu-val>NaN</emu-val>, throw a <emu-val>RangeError</emu-val> exception.</li><li><emu-xref href="#assert" id="_ref_11190"><a href="notational-conventions.html#assert">Assert</a></emu-xref>: <var>tv</var> is an <emu-xref href="#integral-number" id="_ref_11191"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>.</li><li>If <var>tv</var> corresponds with a year that cannot be represented in the <emu-xref href="#sec-date-time-string-format" id="_ref_652"><a href="numbers-and-dates.html#sec-date-time-string-format">Date Time String Format</a></emu-xref>, throw a <emu-val>RangeError</emu-val> exception.</li><li>Return a String representation of <var>tv</var> in the <emu-xref href="#sec-date-time-string-format" id="_ref_653"><a href="numbers-and-dates.html#sec-date-time-string-format">Date Time String Format</a></emu-xref> on the UTC time scale, including all format elements and the UTC offset representation <emu-val>"Z"</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.tojson" type="built-in function">
<h1><span class="secnum">21.4.4.37</span> Date.prototype.toJSON ( <var>key</var> )</h1>
<p>This method provides a String representation of a Date for use by <code>JSON.stringify</code> (<emu-xref href="#sec-json.stringify" id="_ref_654"><a href="structured-data.html#sec-json.stringify">25.5.2</a></emu-xref>).</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>O</var> be ?&nbsp;<emu-xref aoid="ToObject" id="_ref_11192"><a href="abstract-operations.html#sec-toobject">ToObject</a></emu-xref>(<emu-val>this</emu-val> value).</li><li>Let <var>tv</var> be ?&nbsp;<emu-xref aoid="ToPrimitive" id="_ref_11193"><a href="abstract-operations.html#sec-toprimitive" class="e-user-code">ToPrimitive</a></emu-xref>(<var>O</var>, <emu-const>number</emu-const>).</li><li>If <var>tv</var> <emu-xref href="#sec-ecmascript-language-types-number-type" id="_ref_11194"><a href="ecmascript-data-types-and-values.html#sec-ecmascript-language-types-number-type">is a Number</a></emu-xref> and <var>tv</var> is not <emu-xref href="#finite" id="_ref_11195"><a href="ecmascript-data-types-and-values.html#finite">finite</a></emu-xref>, return <emu-val>null</emu-val>.</li><li>Return ?&nbsp;<emu-xref aoid="Invoke" id="_ref_11196"><a href="abstract-operations.html#sec-invoke" class="e-user-code">Invoke</a></emu-xref>(<var>O</var>, <emu-val>"toISOString"</emu-val>).</li></ol></emu-alg>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p>The argument is ignored.</p>
</div></emu-note>
<emu-note><span class="note">Note 2</span><div class="note-contents">
<p>This method is intentionally generic; it does not require that its <emu-val>this</emu-val> value be a Date. Therefore, it can be transferred to other kinds of objects for use as a method. However, it does require that any such object have a <code>toISOString</code> method.</p>
</div></emu-note>
</emu-clause>
<emu-clause id="sec-date.prototype.tolocaledatestring" type="built-in function">
<h1><span class="secnum">21.4.4.38</span> Date.prototype.toLocaleDateString ( [ <var>reserved1</var> [ , <var>reserved2</var> ] ] )</h1>
<p>An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement this method as specified in the ECMA-402 specification. If an ECMAScript implementation does not include the ECMA-402 API the following specification of this method is used:</p>
<p>This method returns a String value. The contents of the String are <emu-xref href="#implementation-defined" id="_ref_11197"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref>, but are intended to represent the “date” portion of the Date in the current time zone in a convenient, human-readable form that corresponds to the conventions of the <emu-xref href="#host-environment" id="_ref_11198"><a href="overview.html#host-environment">host environment</a></emu-xref>'s current locale.</p>
<p>The meaning of the optional parameters to this method are defined in the ECMA-402 specification; implementations that do not include ECMA-402 support must not use those parameter positions for anything else.</p>
</emu-clause>
<emu-clause id="sec-date.prototype.tolocalestring" type="built-in function">
<h1><span class="secnum">21.4.4.39</span> Date.prototype.toLocaleString ( [ <var>reserved1</var> [ , <var>reserved2</var> ] ] )</h1>
<p>An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement this method as specified in the ECMA-402 specification. If an ECMAScript implementation does not include the ECMA-402 API the following specification of this method is used:</p>
<p>This method returns a String value. The contents of the String are <emu-xref href="#implementation-defined" id="_ref_11199"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref>, but are intended to represent the Date in the current time zone in a convenient, human-readable form that corresponds to the conventions of the <emu-xref href="#host-environment" id="_ref_11200"><a href="overview.html#host-environment">host environment</a></emu-xref>'s current locale.</p>
<p>The meaning of the optional parameters to this method are defined in the ECMA-402 specification; implementations that do not include ECMA-402 support must not use those parameter positions for anything else.</p>
</emu-clause>
<emu-clause id="sec-date.prototype.tolocaletimestring" type="built-in function">
<h1><span class="secnum">21.4.4.40</span> Date.prototype.toLocaleTimeString ( [ <var>reserved1</var> [ , <var>reserved2</var> ] ] )</h1>
<p>An ECMAScript implementation that includes the ECMA-402 Internationalization API must implement this method as specified in the ECMA-402 specification. If an ECMAScript implementation does not include the ECMA-402 API the following specification of this method is used:</p>
<p>This method returns a String value. The contents of the String are <emu-xref href="#implementation-defined" id="_ref_11201"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref>, but are intended to represent the “time” portion of the Date in the current time zone in a convenient, human-readable form that corresponds to the conventions of the <emu-xref href="#host-environment" id="_ref_11202"><a href="overview.html#host-environment">host environment</a></emu-xref>'s current locale.</p>
<p>The meaning of the optional parameters to this method are defined in the ECMA-402 specification; implementations that do not include ECMA-402 support must not use those parameter positions for anything else.</p>
</emu-clause>
<emu-clause id="sec-date.prototype.tostring" type="built-in function">
<h1><span class="secnum">21.4.4.41</span> Date.prototype.toString ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11203"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>tv</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>Return <emu-xref aoid="ToDateString" id="_ref_11204"><a href="numbers-and-dates.html#sec-todatestring">ToDateString</a></emu-xref>(<var>tv</var>).</li></ol></emu-alg>
<emu-note><span class="note">Note 1</span><div class="note-contents">
<p>For any Date <code>d</code> such that <code>d.<var class="field">[[DateValue]]</var></code> is evenly divisible by 1000, the result of <code>Date.parse(d.toString())</code> = <code>d.valueOf()</code>. See <emu-xref href="#sec-date.parse" id="_ref_655"><a href="numbers-and-dates.html#sec-date.parse">21.4.3.2</a></emu-xref>.</p>
</div></emu-note>
<emu-note><span class="note">Note 2</span><div class="note-contents">
<p>This method is not generic; it throws a <emu-val>TypeError</emu-val> exception if its <emu-val>this</emu-val> value is not a Date. Therefore, it cannot be transferred to other kinds of objects for use as a method.</p>
</div></emu-note>
<emu-clause id="sec-timestring" type="abstract operation" aoid="TimeString">
<h1><span class="secnum">21.4.4.41.1</span> TimeString ( <var>tv</var> )</h1>
<p>The abstract operation TimeString takes argument <var>tv</var> (a Number, but not <emu-val>NaN</emu-val>) and returns a String. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>hour</var> be <emu-xref aoid="ToZeroPaddedDecimalString" id="_ref_11205"><a href="text-processing.html#sec-tozeropaddeddecimalstring">ToZeroPaddedDecimalString</a></emu-xref>(<emu-xref aoid="" id="_ref_11206"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="HourFromTime" id="_ref_11207"><a href="numbers-and-dates.html#sec-hourfromtime">HourFromTime</a></emu-xref>(<var>tv</var>)), 2).</li><li>Let <var>minute</var> be <emu-xref aoid="ToZeroPaddedDecimalString" id="_ref_11208"><a href="text-processing.html#sec-tozeropaddeddecimalstring">ToZeroPaddedDecimalString</a></emu-xref>(<emu-xref aoid="" id="_ref_11209"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="MinFromTime" id="_ref_11210"><a href="numbers-and-dates.html#sec-minfromtime">MinFromTime</a></emu-xref>(<var>tv</var>)), 2).</li><li>Let <var>second</var> be <emu-xref aoid="ToZeroPaddedDecimalString" id="_ref_11211"><a href="text-processing.html#sec-tozeropaddeddecimalstring">ToZeroPaddedDecimalString</a></emu-xref>(<emu-xref aoid="" id="_ref_11212"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="SecFromTime" id="_ref_11213"><a href="numbers-and-dates.html#sec-secfromtime">SecFromTime</a></emu-xref>(<var>tv</var>)), 2).</li><li>Return the <emu-xref href="#string-concatenation" id="_ref_11214"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>hour</var>, <emu-val>":"</emu-val>, <var>minute</var>, <emu-val>":"</emu-val>, <var>second</var>, the code unit 0x0020 (SPACE), and <emu-val>"GMT"</emu-val>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-datestring" type="abstract operation" aoid="DateString">
<h1><span class="secnum">21.4.4.41.2</span> DateString ( <var>tv</var> )</h1>
<p>The abstract operation DateString takes argument <var>tv</var> (a Number, but not <emu-val>NaN</emu-val>) and returns a String. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>weekday</var> be the Name of the entry in <emu-xref href="#sec-todatestring-day-names" id="_ref_656"><a href="numbers-and-dates.html#sec-todatestring-day-names">Table 60</a></emu-xref> with the Number <emu-xref aoid="WeekDay" id="_ref_11215"><a href="numbers-and-dates.html#sec-weekday">WeekDay</a></emu-xref>(<var>tv</var>).</li><li>Let <var>month</var> be the Name of the entry in <emu-xref href="#sec-todatestring-month-names" id="_ref_657"><a href="numbers-and-dates.html#sec-todatestring-month-names">Table 61</a></emu-xref> with the Number <emu-xref aoid="MonthFromTime" id="_ref_11216"><a href="numbers-and-dates.html#sec-monthfromtime">MonthFromTime</a></emu-xref>(<var>tv</var>).</li><li>Let <var>day</var> be <emu-xref aoid="ToZeroPaddedDecimalString" id="_ref_11217"><a href="text-processing.html#sec-tozeropaddeddecimalstring">ToZeroPaddedDecimalString</a></emu-xref>(<emu-xref aoid="" id="_ref_11218"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="DateFromTime" id="_ref_11219"><a href="numbers-and-dates.html#sec-datefromtime">DateFromTime</a></emu-xref>(<var>tv</var>)), 2).</li><li>Let <var>yv</var> be <emu-xref aoid="YearFromTime" id="_ref_11220"><a href="numbers-and-dates.html#sec-yearfromtime">YearFromTime</a></emu-xref>(<var>tv</var>).</li><li>If <var>yv</var> is <emu-val>+0</emu-val><sub>𝔽</sub> or <var>yv</var> &gt; <emu-val>+0</emu-val><sub>𝔽</sub>, let <var>yearSign</var> be the empty String; else let <var>yearSign</var> be <emu-val>"-"</emu-val>.</li><li>Let <var>paddedYear</var> be <emu-xref aoid="ToZeroPaddedDecimalString" id="_ref_11221"><a href="text-processing.html#sec-tozeropaddeddecimalstring">ToZeroPaddedDecimalString</a></emu-xref>(<emu-xref aoid="abs" id="_ref_11222"><a href="notational-conventions.html#eqn-abs">abs</a></emu-xref>(<emu-xref aoid="" id="_ref_11223"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>yv</var>)), 4).</li><li>Return the <emu-xref href="#string-concatenation" id="_ref_11224"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>weekday</var>, the code unit 0x0020 (SPACE), <var>month</var>, the code unit 0x0020 (SPACE), <var>day</var>, the code unit 0x0020 (SPACE), <var>yearSign</var>, and <var>paddedYear</var>.</li></ol></emu-alg>
<emu-table id="sec-todatestring-day-names" caption="Names of days of the week"><figure><figcaption>Table 60: Names of days of the week</figcaption>
<table>
<thead>
<tr>
<th>
Number
</th>
<th>
Name
</th>
</tr>
</thead>
<tbody><tr>
<td>
<emu-val>+0</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Sun"</emu-val>
</td>
</tr>
<tr>
<td>
<emu-val>1</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Mon"</emu-val>
</td>
</tr>
<tr>
<td>
<emu-val>2</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Tue"</emu-val>
</td>
</tr>
<tr>
<td>
<emu-val>3</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Wed"</emu-val>
</td>
</tr>
<tr>
<td>
<emu-val>4</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Thu"</emu-val>
</td>
</tr>
<tr>
<td>
<emu-val>5</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Fri"</emu-val>
</td>
</tr>
<tr>
<td>
<emu-val>6</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Sat"</emu-val>
</td>
</tr>
</tbody></table>
</figure></emu-table>
<emu-table id="sec-todatestring-month-names" caption="Names of months of the year"><figure><figcaption>Table 61: Names of months of the year</figcaption>
<table>
<thead>
<tr>
<th>
Number
</th>
<th>
Name
</th>
</tr>
</thead>
<tbody><tr>
<td>
<emu-val>+0</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Jan"</emu-val>
</td>
</tr>
<tr>
<td>
<emu-val>1</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Feb"</emu-val>
</td>
</tr>
<tr>
<td>
<emu-val>2</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Mar"</emu-val>
</td>
</tr>
<tr>
<td>
<emu-val>3</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Apr"</emu-val>
</td>
</tr>
<tr>
<td>
<emu-val>4</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"May"</emu-val>
</td>
</tr>
<tr>
<td>
<emu-val>5</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Jun"</emu-val>
</td>
</tr>
<tr>
<td>
<emu-val>6</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Jul"</emu-val>
</td>
</tr>
<tr>
<td>
<emu-val>7</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Aug"</emu-val>
</td>
</tr>
<tr>
<td>
<emu-val>8</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Sep"</emu-val>
</td>
</tr>
<tr>
<td>
<emu-val>9</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Oct"</emu-val>
</td>
</tr>
<tr>
<td>
<emu-val>10</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Nov"</emu-val>
</td>
</tr>
<tr>
<td>
<emu-val>11</emu-val><sub>𝔽</sub>
</td>
<td>
<emu-val>"Dec"</emu-val>
</td>
</tr>
</tbody></table>
</figure></emu-table>
</emu-clause>
<emu-clause id="sec-timezoneestring" type="abstract operation" aoid="TimeZoneString">
<h1><span class="secnum">21.4.4.41.3</span> TimeZoneString ( <var>tv</var> )</h1>
<p>The abstract operation TimeZoneString takes argument <var>tv</var> (an <emu-xref href="#integral-number" id="_ref_11225"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref>) and returns a String. It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>systemTimeZoneIdentifier</var> be <emu-xref aoid="SystemTimeZoneIdentifier" id="_ref_11226"><a href="numbers-and-dates.html#sec-systemtimezoneidentifier">SystemTimeZoneIdentifier</a></emu-xref>().</li><li>If <emu-xref aoid="IsTimeZoneOffsetString" id="_ref_11227"><a href="numbers-and-dates.html#sec-istimezoneoffsetstring">IsTimeZoneOffsetString</a></emu-xref>(<var>systemTimeZoneIdentifier</var>) is <emu-val>true</emu-val>, then<ol><li>Let <var>offsetNs</var> be <emu-xref aoid="ParseTimeZoneOffsetString" id="_ref_11228"><a href="numbers-and-dates.html#sec-parsetimezoneoffsetstring">ParseTimeZoneOffsetString</a></emu-xref>(<var>systemTimeZoneIdentifier</var>).</li></ol></li><li>Else,<ol><li>Let <var>offsetNs</var> be <emu-xref aoid="GetNamedTimeZoneOffsetNanoseconds" id="_ref_11229"><a href="numbers-and-dates.html#sec-getnamedtimezoneoffsetnanoseconds">GetNamedTimeZoneOffsetNanoseconds</a></emu-xref>(<var>systemTimeZoneIdentifier</var>, <emu-xref aoid="" id="_ref_11230"><a href="notational-conventions.html#%E2%84%A4"></a></emu-xref>(<emu-xref aoid="" id="_ref_11231"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>tv</var>) × 10<sup>6</sup>)).</li></ol></li><li>Let <var>offset</var> be <emu-xref aoid="𝔽" id="_ref_11232"><a href="notational-conventions.html#%F0%9D%94%BD">𝔽</a></emu-xref>(<emu-xref aoid="truncate" id="_ref_11233"><a href="notational-conventions.html#eqn-truncate">truncate</a></emu-xref>(<var>offsetNs</var> / 10<sup>6</sup>)).</li><li>If <var>offset</var> is <emu-val>+0</emu-val><sub>𝔽</sub> or <var>offset</var> &gt; <emu-val>+0</emu-val><sub>𝔽</sub>, then<ol><li>Let <var>offsetSign</var> be <emu-val>"+"</emu-val>.</li><li>Let <var>absOffset</var> be <var>offset</var>.</li></ol></li><li>Else,<ol><li>Let <var>offsetSign</var> be <emu-val>"-"</emu-val>.</li><li>Let <var>absOffset</var> be -<var>offset</var>.</li></ol></li><li>Let <var>offsetMin</var> be <emu-xref aoid="ToZeroPaddedDecimalString" id="_ref_11234"><a href="text-processing.html#sec-tozeropaddeddecimalstring">ToZeroPaddedDecimalString</a></emu-xref>(<emu-xref aoid="" id="_ref_11235"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="MinFromTime" id="_ref_11236"><a href="numbers-and-dates.html#sec-minfromtime">MinFromTime</a></emu-xref>(<var>absOffset</var>)), 2).</li><li>Let <var>offsetHour</var> be <emu-xref aoid="ToZeroPaddedDecimalString" id="_ref_11237"><a href="text-processing.html#sec-tozeropaddeddecimalstring">ToZeroPaddedDecimalString</a></emu-xref>(<emu-xref aoid="" id="_ref_11238"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="HourFromTime" id="_ref_11239"><a href="numbers-and-dates.html#sec-hourfromtime">HourFromTime</a></emu-xref>(<var>absOffset</var>)), 2).</li><li>Let <var>tzName</var> be an <emu-xref href="#implementation-defined" id="_ref_11240"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> string that is either the empty String or the <emu-xref href="#string-concatenation" id="_ref_11241"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of the code unit 0x0020 (SPACE), the code unit 0x0028 (LEFT PARENTHESIS), an <emu-xref href="#implementation-defined" id="_ref_11242"><a href="overview.html#implementation-defined">implementation-defined</a></emu-xref> timezone name, and the code unit 0x0029 (RIGHT PARENTHESIS).</li><li>Return the <emu-xref href="#string-concatenation" id="_ref_11243"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>offsetSign</var>, <var>offsetHour</var>, <var>offsetMin</var>, and <var>tzName</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-todatestring" type="abstract operation" aoid="ToDateString">
<h1><span class="secnum">21.4.4.41.4</span> ToDateString ( <var>tv</var> )</h1>
<p>The abstract operation ToDateString takes argument <var>tv</var> (an <emu-xref href="#integral-number" id="_ref_11244"><a href="notational-conventions.html#integral-number">integral Number</a></emu-xref> or <emu-val>NaN</emu-val>) and returns a String. It performs the following steps when called:</p>
<emu-alg><ol><li>If <var>tv</var> is <emu-val>NaN</emu-val>, return <emu-val>"Invalid Date"</emu-val>.</li><li>Let <var>t</var> be <emu-xref aoid="LocalTime" id="_ref_11245"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>tv</var>).</li><li>Return the <emu-xref href="#string-concatenation" id="_ref_11246"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <emu-xref aoid="DateString" id="_ref_11247"><a href="numbers-and-dates.html#sec-datestring">DateString</a></emu-xref>(<var>t</var>), the code unit 0x0020 (SPACE), <emu-xref aoid="TimeString" id="_ref_11248"><a href="numbers-and-dates.html#sec-timestring">TimeString</a></emu-xref>(<var>t</var>), and <emu-xref aoid="TimeZoneString" id="_ref_11249"><a href="numbers-and-dates.html#sec-timezoneestring">TimeZoneString</a></emu-xref>(<var>tv</var>).</li></ol></emu-alg>
</emu-clause>
</emu-clause>
<emu-clause id="sec-date.prototype.totimestring" type="built-in function">
<h1><span class="secnum">21.4.4.42</span> Date.prototype.toTimeString ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11250"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>tv</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>tv</var> is <emu-val>NaN</emu-val>, return <emu-val>"Invalid Date"</emu-val>.</li><li>Let <var>t</var> be <emu-xref aoid="LocalTime" id="_ref_11251"><a href="numbers-and-dates.html#sec-localtime">LocalTime</a></emu-xref>(<var>tv</var>).</li><li>Return the <emu-xref href="#string-concatenation" id="_ref_11252"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <emu-xref aoid="TimeString" id="_ref_11253"><a href="numbers-and-dates.html#sec-timestring">TimeString</a></emu-xref>(<var>t</var>) and <emu-xref aoid="TimeZoneString" id="_ref_11254"><a href="numbers-and-dates.html#sec-timezoneestring">TimeZoneString</a></emu-xref>(<var>tv</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.toutcstring" type="built-in function">
<h1><span class="secnum">21.4.4.43</span> Date.prototype.toUTCString ( )</h1>
<p>This method returns a String value representing the instant in time corresponding to the <emu-val>this</emu-val> value. The format of the String is based upon "HTTP-date" from RFC 7231, generalized to support the full range of times supported by ECMAScript Dates.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11255"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Let <var>tv</var> be <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li><li>If <var>tv</var> is <emu-val>NaN</emu-val>, return <emu-val>"Invalid Date"</emu-val>.</li><li>Let <var>weekday</var> be the Name of the entry in <emu-xref href="#sec-todatestring-day-names" id="_ref_658"><a href="numbers-and-dates.html#sec-todatestring-day-names">Table 60</a></emu-xref> with the Number <emu-xref aoid="WeekDay" id="_ref_11256"><a href="numbers-and-dates.html#sec-weekday">WeekDay</a></emu-xref>(<var>tv</var>).</li><li>Let <var>month</var> be the Name of the entry in <emu-xref href="#sec-todatestring-month-names" id="_ref_659"><a href="numbers-and-dates.html#sec-todatestring-month-names">Table 61</a></emu-xref> with the Number <emu-xref aoid="MonthFromTime" id="_ref_11257"><a href="numbers-and-dates.html#sec-monthfromtime">MonthFromTime</a></emu-xref>(<var>tv</var>).</li><li>Let <var>day</var> be <emu-xref aoid="ToZeroPaddedDecimalString" id="_ref_11258"><a href="text-processing.html#sec-tozeropaddeddecimalstring">ToZeroPaddedDecimalString</a></emu-xref>(<emu-xref aoid="" id="_ref_11259"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<emu-xref aoid="DateFromTime" id="_ref_11260"><a href="numbers-and-dates.html#sec-datefromtime">DateFromTime</a></emu-xref>(<var>tv</var>)), 2).</li><li>Let <var>yv</var> be <emu-xref aoid="YearFromTime" id="_ref_11261"><a href="numbers-and-dates.html#sec-yearfromtime">YearFromTime</a></emu-xref>(<var>tv</var>).</li><li>If <var>yv</var> is <emu-val>+0</emu-val><sub>𝔽</sub> or <var>yv</var> &gt; <emu-val>+0</emu-val><sub>𝔽</sub>, let <var>yearSign</var> be the empty String; else let <var>yearSign</var> be <emu-val>"-"</emu-val>.</li><li>Let <var>paddedYear</var> be <emu-xref aoid="ToZeroPaddedDecimalString" id="_ref_11262"><a href="text-processing.html#sec-tozeropaddeddecimalstring">ToZeroPaddedDecimalString</a></emu-xref>(<emu-xref aoid="abs" id="_ref_11263"><a href="notational-conventions.html#eqn-abs">abs</a></emu-xref>(<emu-xref aoid="" id="_ref_11264"><a href="notational-conventions.html#%E2%84%9D"></a></emu-xref>(<var>yv</var>)), 4).</li><li>Return the <emu-xref href="#string-concatenation" id="_ref_11265"><a href="ecmascript-data-types-and-values.html#string-concatenation">string-concatenation</a></emu-xref> of <var>weekday</var>, <emu-val>","</emu-val>, the code unit 0x0020 (SPACE), <var>day</var>, the code unit 0x0020 (SPACE), <var>month</var>, the code unit 0x0020 (SPACE), <var>yearSign</var>, <var>paddedYear</var>, the code unit 0x0020 (SPACE), and <emu-xref aoid="TimeString" id="_ref_11266"><a href="numbers-and-dates.html#sec-timestring">TimeString</a></emu-xref>(<var>tv</var>).</li></ol></emu-alg>
</emu-clause>
<emu-clause id="sec-date.prototype.valueof" type="built-in function">
<h1><span class="secnum">21.4.4.44</span> Date.prototype.valueOf ( )</h1>
<p>This method performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>dateObject</var> be the <emu-val>this</emu-val> value.</li><li>Perform ?&nbsp;<emu-xref aoid="RequireInternalSlot" id="_ref_11267"><a href="ordinary-and-exotic-objects-behaviours.html#sec-requireinternalslot">RequireInternalSlot</a></emu-xref>(<var>dateObject</var>, <var class="field">[[DateValue]]</var>).</li><li>Return <var>dateObject</var>.<var class="field">[[DateValue]]</var>.</li></ol></emu-alg>
</emu-clause>
<emu-clause oldids="sec-date.prototype-@@toprimitive" id="sec-date.prototype-%symbol.toprimitive%" type="built-in function"><span id="sec-date.prototype-@@toprimitive"></span>
<h1><span class="secnum">21.4.4.45</span> Date.prototype [ %Symbol.toPrimitive% ] ( <var>hint</var> )</h1>
<p>This method is called by ECMAScript language operators to convert a Date to a primitive value. The allowed values for <var>hint</var> are <emu-val>"default"</emu-val>, <emu-val>"number"</emu-val>, and <emu-val>"string"</emu-val>. Dates are unique among built-in ECMAScript object in that they treat <emu-val>"default"</emu-val> as being equivalent to <emu-val>"string"</emu-val>, All other built-in ECMAScript objects treat <emu-val>"default"</emu-val> as being equivalent to <emu-val>"number"</emu-val>.</p>
<p>It performs the following steps when called:</p>
<emu-alg><ol><li>Let <var>O</var> be the <emu-val>this</emu-val> value.</li><li>If <var>O</var> <emu-xref href="#sec-object-type" id="_ref_11268"><a href="ecmascript-data-types-and-values.html#sec-object-type">is not an Object</a></emu-xref>, throw a <emu-val>TypeError</emu-val> exception.</li><li>If <var>hint</var> is either <emu-val>"string"</emu-val> or <emu-val>"default"</emu-val>, then<ol><li>Let <var>tryFirst</var> be <emu-const>string</emu-const>.</li></ol></li><li>Else if <var>hint</var> is <emu-val>"number"</emu-val>, then<ol><li>Let <var>tryFirst</var> be <emu-const>number</emu-const>.</li></ol></li><li>Else,<ol><li>Throw a <emu-val>TypeError</emu-val> exception.</li></ol></li><li>Return ?&nbsp;<emu-xref aoid="OrdinaryToPrimitive" id="_ref_11269"><a href="abstract-operations.html#sec-ordinarytoprimitive" class="e-user-code">OrdinaryToPrimitive</a></emu-xref>(<var>O</var>, <var>tryFirst</var>).</li></ol></emu-alg>
<p>This property has the attributes { <var class="field">[[Writable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Enumerable]]</var>: <emu-val>false</emu-val>, <var class="field">[[Configurable]]</var>: <emu-val>true</emu-val> }.</p>
<p>The value of the <emu-val>"name"</emu-val> property of this method is <emu-val>"[Symbol.toPrimitive]"</emu-val>.</p>
</emu-clause>
</emu-clause>
<emu-clause id="sec-properties-of-date-instances">
<h1><span class="secnum">21.4.5</span> Properties of Date Instances</h1>
<p>Date instances are <emu-xref href="#ordinary-object" id="_ref_11270"><a href="ecmascript-data-types-and-values.html#ordinary-object">ordinary objects</a></emu-xref> that inherit properties from the <emu-xref href="#sec-properties-of-the-date-prototype-object" id="_ref_11271"><a href="numbers-and-dates.html#sec-properties-of-the-date-prototype-object">Date prototype object</a></emu-xref>. Date instances also have a <var class="field">[[DateValue]]</var> internal slot. The <var class="field">[[DateValue]]</var> internal slot is the <emu-xref href="#sec-time-values-and-time-range" id="_ref_11272"><a href="numbers-and-dates.html#sec-time-values-and-time-range">time value</a></emu-xref> represented by this Date.</p>
</emu-clause>
</emu-clause>
</emu-clause></div></body></html>