21 Numbers and Dates

21.1 Number Objects

21.1.1 The Number Constructor

Number constructor는:

  • %Number%입니다.
  • global object"Number" property의 initial value입니다.
  • constructor로 called될 때 new Number object를 create하고 initialize합니다.
  • constructor가 아니라 function으로 called될 때 type conversion을 수행합니다.
  • class definition의 extends clause의 value로 사용될 수 있습니다. specified Number behaviour를 inherit하려는 subclass constructor[[NumberData]] internal slot을 가진 subclass instance를 create하고 initialize하기 위해 Number constructor에 대한 super call을 include해야 합니다.

21.1.1.1 Number ( value )

이 function은 called될 때 다음 step을 수행합니다:

  1. value가 present이면, 다음을 수행한다.
    1. primitive를 ? ToNumeric(value)로 둔다.
    2. primitive가 BigInt이면, n𝔽((primitive))로 둔다.
    3. 그렇지 않으면, nprimitive로 둔다.
  2. 그렇지 않으면,
    1. n+0𝔽로 둔다.
  3. NewTarget이 undefined이면, n을 반환한다.
  4. obj를 ? OrdinaryCreateFromConstructor(NewTarget, "%Number.prototype%", « [[NumberData]] »)로 둔다.
  5. obj.[[NumberData]]n으로 설정한다.
  6. obj를 반환한다.

21.1.2 Properties of the Number Constructor

Number constructor는:

  • value가 %Function.prototype%[[Prototype]] internal slot을 가집니다.
  • 다음 property를 가집니다:

21.1.2.1 Number.EPSILON

Number.EPSILON의 value는 Number value로 represent 가능한 1보다 큰 smallest value와 1 사이의 difference의 magnitude에 대한 Number value이며, 이는 approximately 2.2204460492503130808472633361816 × 10-16입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

21.1.2.2 Number.isFinite ( number )

이 function은 called될 때 다음 step을 수행합니다:

  1. number가 Number가 아니면, false를 반환한다.
  2. numberfinite가 아니면, false를 반환한다.
  3. true를 반환한다.

21.1.2.3 Number.isInteger ( number )

이 function은 called될 때 다음 step을 수행합니다:

  1. numberintegral Number이면, true를 반환한다.
  2. false를 반환한다.

21.1.2.4 Number.isNaN ( number )

이 function은 called될 때 다음 step을 수행합니다:

  1. number가 Number가 아니면, false를 반환한다.
  2. numberNaN이면, true를 반환한다.
  3. false를 반환한다.
Note

이 function은 argument가 NaN인지 determine하기 전에 Number로 convert하지 않는다는 점에서 global isNaN function(19.2.3)과 다릅니다.

21.1.2.5 Number.isSafeInteger ( number )

Note

integer nn에 대한 Number value가 any other integer에 대한 Number value가 아닌 경우에만 “safe integer”입니다.

이 function은 called될 때 다음 step을 수행합니다:

  1. numberintegral Number이면, 다음을 수행한다.
    1. abs((number)) ≤ 253 - 1이면, true를 반환한다.
  2. false를 반환한다.

21.1.2.6 Number.MAX_SAFE_INTEGER

Note

IEEE 754-2019의 precision limitation 때문에 necessary한 rounding behaviour로 인해, Number.MAX_SAFE_INTEGER보다 큰 every integer에 대한 Number value는 at least one other integer와 shared됩니다. 따라서 such large-magnitude integersafe하지 않으며, Number value로 exactly represent 가능하거나 서로 distinguish 가능하다고 guaranteed되지 않습니다. 예를 들어, 90071992547409929007199254740993 둘 다 Number value 9007199254740992𝔽로 evaluate됩니다.

Number.MAX_SAFE_INTEGER의 value는 9007199254740991𝔽 (𝔽(253 - 1))입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

21.1.2.7 Number.MAX_VALUE

Number.MAX_VALUE의 value는 Number type의 largest positive finite value이며, 이는 approximately 1.7976931348623157 × 10308입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

21.1.2.8 Number.MIN_SAFE_INTEGER

Note

IEEE 754-2019의 precision limitation 때문에 necessary한 rounding behaviour로 인해, Number.MIN_SAFE_INTEGER보다 작은 every integer에 대한 Number value는 at least one other integer와 shared됩니다. 따라서 such large-magnitude integersafe하지 않으며, Number value로 exactly represent 가능하거나 서로 distinguish 가능하다고 guaranteed되지 않습니다. 예를 들어, -9007199254740992-9007199254740993 둘 다 Number value -9007199254740992𝔽로 evaluate됩니다.

Number.MIN_SAFE_INTEGER의 value는 -9007199254740991𝔽 (𝔽(-(253 - 1)))입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

21.1.2.9 Number.MIN_VALUE

Number.MIN_VALUE의 value는 Number type의 smallest positive value이며, 이는 approximately 5 × 10-324입니다.

IEEE 754-2019 double precision binary representation에서, smallest possible value는 denormalized number입니다. implementation이 denormalized value를 support하지 않으면, Number.MIN_VALUE의 value는 implementation에 의해 actually represented될 수 있는 smallest non-zero positive value여야 합니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

21.1.2.10 Number.NaN

Number.NaN의 value는 NaN입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

21.1.2.11 Number.NEGATIVE_INFINITY

Number.NEGATIVE_INFINITY의 value는 -∞𝔽입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

21.1.2.12 Number.parseFloat ( string )

"parseFloat" property의 initial value는 %parseFloat%입니다.

21.1.2.13 Number.parseInt ( string, radix )

"parseInt" property의 initial value는 %parseInt%입니다.

21.1.2.14 Number.POSITIVE_INFINITY

Number.POSITIVE_INFINITY의 value는 +∞𝔽입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

21.1.2.15 Number.prototype

Number.prototype의 initial value는 Number prototype object입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

21.1.3 Properties of the Number Prototype Object

Number prototype object는:

  • %Number.prototype%입니다.
  • ordinary object입니다.
  • itself가 Number object입니다; value가 +0𝔽[[NumberData]] internal slot을 가집니다.
  • value가 %Object.prototype%[[Prototype]] internal slot을 가집니다.

explicitly 달리 stated되지 않는 한, 아래에 defined된 Number prototype object의 method는 generic하지 않고, 이들에게 passed되는 this value는 Number value이거나 Number value로 initialized된 [[NumberData]] internal slot을 가진 object여야 합니다.

method specification 안의 phrase “this Number value”는 method invocation의 this value를 argument로 pass하여 abstract operation ThisNumberValue를 calling한 result를 refer합니다.

21.1.3.1 Number.prototype.constructor

Number.prototype.constructor의 initial value는 %Number%입니다.

21.1.3.2 Number.prototype.toExponential ( fractionDigits )

이 method는 significand의 decimal point 앞에 one digit, significand의 decimal point 뒤에 fractionDigits digits를 가진 decimal exponential notation으로 represented된 this Number value를 contain하는 String을 반환합니다. fractionDigitsundefined이면, Number를 uniquely specify하는 데 necessary한 만큼의 significand digit을 include합니다(ToString에서와 같지만, 이 경우 Number는 always exponential notation으로 output됩니다).

called될 때 다음 step을 수행합니다:

  1. number를 ? ThisNumberValue(this value)로 둔다.
  2. fractionCount를 ? ToIntegerOrInfinity(fractionDigits)로 둔다.
  3. Assert: fractionDigitsundefined이면, fractionCount는 0이다.
  4. numberfinite가 아니면, Number::toString(number, 10)을 반환한다.
  5. fractionCount < 0 또는 fractionCount > 100이면, RangeError exception을 throw한다.
  6. number(number)로 설정한다.
  7. sign을 empty String으로 둔다.
  8. number < 0이면, 다음을 수행한다.
    1. sign"-"로 설정한다.
    2. number를 -number로 설정한다.
  9. number = 0이면, 다음을 수행한다.
    1. significand를 code unit 0x0030 (DIGIT ZERO)가 fractionCount + 1번 occurrence하는 것으로 구성된 String value로 둔다.
    2. exponent를 0으로 둔다.
  10. 그렇지 않으면,
    1. fractionDigitsundefined가 아니면, 다음을 수행한다.
      1. exponentintSignificand를 10fractionCountintSignificand < 10fractionCount + 1이고 intSignificand × 10exponent - fractionCount - number가 가능한 한 zero에 close한 integers로 둔다. such exponentintSignificand의 set이 two이면, intSignificand × 10exponent - fractionCount가 larger인 exponentintSignificand를 pick한다.
    2. 그렇지 않으면,
      1. exponent, intSignificand, 및 ffff ≥ 0, 10ffintSignificand < 10ff + 1, 𝔽(intSignificand × 10exponent - ff) is 𝔽(number), 그리고 ff가 가능한 한 small인 integers로 둔다. intSignificand의 decimal representation은 ff + 1 digits를 가지고, intSignificand는 10으로 divisible하지 않으며, intSignificand의 least significant digit이 these criteria에 의해 necessarily uniquely determined되는 것은 아님에 note한다.
      2. fractionCountff로 설정한다.
    3. significandintSignificand의 decimal representation의 digits로 구성된 String value로 둔다(in order, with no leading zeroes).
  11. fractionCount ≠ 0이면, 다음을 수행한다.
    1. intPartsignificand의 first code unit으로 둔다.
    2. fractionalPartsignificand의 other fractionCount code unit으로 둔다.
    3. significandintPart, ".", 및 fractionalPartstring-concatenation으로 설정한다.
  12. exponent = 0이면, 다음을 수행한다.
    1. exponentSign"+"로 둔다.
    2. exponentDigits"0"으로 둔다.
  13. 그렇지 않으면,
    1. exponent > 0이면, 다음을 수행한다.
      1. exponentSign"+"로 둔다.
    2. 그렇지 않으면,
      1. Assert: exponent < 0이다.
      2. exponentSign"-"로 둔다.
      3. exponent를 -exponent로 설정한다.
    3. exponentDigitsexponent의 decimal representation의 digits로 구성된 String value로 둔다(in order, with no leading zeroes).
  14. significandsignificand, "e", exponentSign, 및 exponentDigitsstring-concatenation으로 설정한다.
  15. signsignificandstring-concatenation을 반환한다.
Note

above rules에 의해 required되는 것보다 more accurate conversion을 provide하는 implementation의 경우, step 10.b.i의 다음 alternative version을 guideline으로 사용할 것이 recommended됩니다:

  1. exponent, intSignificand, 및 ffff ≥ 0, 10ffintSignificand < 10ff + 1, 𝔽(intSignificand × 10exponent - ff) is 𝔽(number), 그리고 ff가 가능한 한 small인 integers로 둔다. intSignificand에 대해 multiple possibility가 있으면, 𝔽(intSignificand × 10exponent - ff)가 𝔽(number)에 closest한 intSignificand를 choose한다. such possible value of intSignificand가 two이면, even인 것을 choose한다.

21.1.3.3 Number.prototype.toFixed ( fractionDigits )

Note 1

이 method는 decimal point 뒤에 fractionDigits digits를 가진 decimal fixed-point notation으로 represented된 this Number value를 contain하는 String을 반환합니다. fractionDigitsundefined이면, 0이 assumed됩니다.

called될 때 다음 step을 수행합니다:

  1. number를 ? ThisNumberValue(this value)로 둔다.
  2. fractionCount를 ? ToIntegerOrInfinity(fractionDigits)로 둔다.
  3. Assert: fractionDigitsundefined이면, fractionCount는 0이다.
  4. fractionCountfinite가 아니면, RangeError exception을 throw한다.
  5. fractionCount < 0 또는 fractionCount > 100이면, RangeError exception을 throw한다.
  6. numberfinite가 아니면, Number::toString(number, 10)을 반환한다.
  7. number(number)로 설정한다.
  8. sign을 empty String으로 둔다.
  9. number < 0이면, 다음을 수행한다.
    1. sign"-"로 설정한다.
    2. number를 -number로 설정한다.
  10. number ≥ 1021이면, 다음을 수행한다.
    1. digitString을 ! ToString(𝔽(number))으로 둔다.
  11. 그렇지 않으면,
    1. intValueintValue / 10fractionCount - number가 가능한 한 zero에 close한 integer로 둔다. such intValue가 two이면, larger intValue를 pick한다.
    2. intValue = 0이면, digitString"0"으로 둔다; 그렇지 않으면 digitStringintValue의 decimal representation의 digits로 구성된 String value로 둔다(in order, with no leading zeroes).
    3. fractionCount ≠ 0이면, 다음을 수행한다.
      1. digitCountdigitString의 length로 둔다.
      2. digitCountfractionCount이면, 다음을 수행한다.
        1. zeroPad를 code unit 0x0030 (DIGIT ZERO)가 fractionCount + 1 - digitCount번 occurrence하는 것으로 구성된 String value로 둔다.
        2. digitStringzeroPaddigitStringstring-concatenation으로 설정한다.
        3. digitCountfractionCount + 1로 설정한다.
      3. intPartdigitString의 first digitCount - fractionCount code units로 둔다.
      4. fractionalPartdigitString의 other fractionCount code units로 둔다.
      5. digitStringintPart, ".", 및 fractionalPartstring-concatenation으로 설정한다.
  12. signdigitStringstring-concatenation을 반환한다.
Note 2

toString은 adjacent Number value와 number를 distinguish하기에 enough significant digits만 print하므로, some value에 대해 toFixed의 output은 toString보다 more precise할 수 있습니다. 예를 들어,

(1000000000000000128).toString()"1000000000000000100"을 반환하는 반면,
(1000000000000000128).toFixed(0)"1000000000000000128"을 반환합니다.

21.1.3.4 Number.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )

ECMA-402 Internationalization API를 include하는 ECMAScript implementation은 ECMA-402 specification에 specified된 대로 이 method를 implement해야 합니다. ECMAScript implementation이 ECMA-402 API를 include하지 않으면 이 method의 다음 specification이 사용됩니다:

이 method는 host environment의 current locale의 convention에 따라 formatted된 this Number value를 represent하는 String value를 produce합니다. 이 method는 implementation-defined이며, toString과 same thing을 return하는 것이 permissible하지만 encouraged되지는 않습니다.

이 method의 optional parameter의 meaning은 ECMA-402 specification에 defined되어 있습니다; ECMA-402 support를 include하지 않는 implementation은 those parameter position을 anything else에 사용해서는 안 됩니다.

21.1.3.5 Number.prototype.toPrecision ( precision )

이 method는 significand의 decimal point 앞에 one digit, significand의 decimal point 뒤에 precision - 1 digits를 가진 decimal exponential notation 또는 precision significant digits를 가진 decimal fixed notation 중 하나로 represented된 this Number value를 contain하는 String을 반환합니다. precisionundefined이면, 대신 ToString을 call합니다.

called될 때 다음 step을 수행합니다:

  1. number를 ? ThisNumberValue(this value)로 둔다.
  2. precisionundefined이면, ! ToString(number)을 반환한다.
  3. precisionCount를 ? ToIntegerOrInfinity(precision)로 둔다.
  4. numberfinite가 아니면, Number::toString(number, 10)을 반환한다.
  5. precisionCount < 1 또는 precisionCount > 100이면, RangeError exception을 throw한다.
  6. number(number)로 설정한다.
  7. sign을 empty String으로 둔다.
  8. number < 0이면, 다음을 수행한다.
    1. sign을 code unit 0x002D (HYPHEN-MINUS)로 설정한다.
    2. number를 -number로 설정한다.
  9. number = 0이면, 다음을 수행한다.
    1. significand를 code unit 0x0030 (DIGIT ZERO)가 precisionCount번 occurrence하는 것으로 구성된 String value로 둔다.
    2. exponent를 0으로 둔다.
  10. 그렇지 않으면,
    1. exponentintSignificand를 10precisionCount - 1intSignificand < 10precisionCount이고 intSignificand × 10exponent - precisionCount + 1 - number가 가능한 한 zero에 close한 integers로 둔다. such exponentintSignificand의 set이 two이면, intSignificand × 10exponent - precisionCount + 1이 larger인 exponentintSignificand를 pick한다.
    2. significandintSignificand의 decimal representation의 digits로 구성된 String value로 둔다(in order, with no leading zeroes).
    3. exponent < -6 또는 exponentprecisionCount이면, 다음을 수행한다.
      1. Assert: exponent ≠ 0이다.
      2. precisionCount ≠ 1이면, 다음을 수행한다.
        1. intPartsignificand의 first code unit으로 둔다.
        2. fractionalPartsignificand의 other precisionCount - 1 code units로 둔다.
        3. significandintPart, ".", 및 fractionalPartstring-concatenation으로 설정한다.
      3. exponent > 0이면, 다음을 수행한다.
        1. exponentSign을 code unit 0x002B (PLUS SIGN)로 둔다.
      4. 그렇지 않으면,
        1. Assert: exponent < 0이다.
        2. exponentSign을 code unit 0x002D (HYPHEN-MINUS)로 둔다.
        3. exponent를 -exponent로 설정한다.
      5. exponentDigitsexponent의 decimal representation의 digits로 구성된 String value로 둔다(in order, with no leading zeroes).
      6. sign, significand, code unit 0x0065 (LATIN SMALL LETTER E), exponentSign, 및 exponentDigitsstring-concatenation을 반환한다.
  11. exponent = precisionCount - 1이면, signsignificandstring-concatenation을 반환한다.
  12. exponent ≥ 0이면, 다음을 수행한다.
    1. significandsignificand의 first exponent + 1 code units, code unit 0x002E (FULL STOP), 및 significand의 remaining precisionCount - (exponent + 1) code units의 string-concatenation으로 설정한다.
  13. 그렇지 않으면,
    1. significand를 code unit 0x0030 (DIGIT ZERO), code unit 0x002E (FULL STOP), code unit 0x0030 (DIGIT ZERO)의 -(exponent + 1) occurrences, 및 String significandstring-concatenation으로 설정한다.
  14. signsignificandstring-concatenation을 반환한다.

21.1.3.6 Number.prototype.toString ( [ radix ] )

Note

optional radix2𝔽부터 36𝔽까지의 inclusive interval 안에 있는 integral Number value여야 합니다. radixundefined이면 10𝔽radix의 value로 사용됩니다.

이 method는 called될 때 다음 step을 수행합니다:

  1. x를 ? ThisNumberValue(this value)로 둔다.
  2. radixundefined이면, radixMV를 10으로 둔다.
  3. 그렇지 않으면, radixMV를 ? ToIntegerOrInfinity(radix)로 둔다.
  4. radixMV가 2부터 36까지의 inclusive interval 안에 있지 않으면, RangeError exception을 throw한다.
  5. Number::toString(x, radixMV)를 반환한다.

이 method는 generic하지 않습니다; this value가 Number 또는 Number object가 아니면 TypeError exception을 throw합니다. 따라서 method로 사용하기 위해 다른 kind의 object로 transferred될 수 없습니다.

이 method의 "length" property는 1𝔽입니다.

21.1.3.7 Number.prototype.valueOf ( )

  1. ThisNumberValue(this value)를 반환한다.

21.1.3.7.1 ThisNumberValue ( arg )

The abstract operation ThisNumberValue takes argument arg (an ECMAScript language value) and returns either a normal completion containing a Number or a throw completion. It performs the following steps when called:

  1. arg가 Number이면, arg를 반환한다.
  2. arg가 Object이고 arg[[NumberData]] internal slot을 가지면, 다음을 수행한다.
    1. numberarg.[[NumberData]]로 둔다.
    2. Assert: number는 Number이다.
    3. number를 반환한다.
  3. TypeError exception을 throw한다.

21.1.4 Properties of Number Instances

Number instance는 Number prototype object에서 property를 inherit하는 ordinary object입니다. Number instance는 또한 [[NumberData]] internal slot을 가집니다. [[NumberData]] internal slot은 이 Number object가 represented하는 Number value입니다.

21.2 BigInt Objects

21.2.1 The BigInt Constructor

BigInt constructor는:

  • %BigInt%입니다.
  • global object"BigInt" property의 initial value입니다.
  • constructor가 아니라 function으로 called될 때 type conversion을 수행합니다.
  • new operator와 함께 사용되거나 subclassed되도록 intended되지 않습니다. class definition의 extends clause의 value로 사용될 수 있지만 BigInt constructor에 대한 super call은 exception을 cause합니다.

21.2.1.1 BigInt ( value )

이 function은 called될 때 다음 step을 수행합니다:

  1. NewTarget이 undefined가 아니면, TypeError exception을 throw한다.
  2. primitive를 ? ToPrimitive(value, number)로 둔다.
  3. primitive가 Number이면, ? NumberToBigInt(primitive)를 반환한다.
  4. ToBigInt(primitive)를 반환한다.

21.2.1.1.1 NumberToBigInt ( number )

The abstract operation NumberToBigInt takes argument number (a Number) and returns either a normal completion containing a BigInt or a throw completion. It performs the following steps when called:

  1. numberintegral Number가 아니면, RangeError exception을 throw한다.
  2. ((number))를 반환한다.

21.2.2 Properties of the BigInt Constructor

BigInt constructor는:

  • value가 %Function.prototype%[[Prototype]] internal slot을 가집니다.
  • 다음 property를 가집니다:

21.2.2.1 BigInt.asIntN ( bits, bigint )

이 function은 called될 때 다음 step을 수행합니다:

  1. bits를 ? ToIndex(bits)로 설정한다.
  2. bigint를 ? ToBigInt(bigint)로 설정한다.
  3. remainder(bigint) modulo 2bits라고 하자.
  4. remainder ≥ 2bits - 1이면, (remainder - 2bits)를 반환한다.
  5. (remainder)를 반환한다.

21.2.2.2 BigInt.asUintN ( bits, bigint )

이 function은 called될 때 다음 step을 수행합니다:

  1. bits를 ? ToIndex(bits)로 설정한다.
  2. bigint를 ? ToBigInt(bigint)로 설정한다.
  3. ((bigint) modulo 2bits)를 반환한다.

21.2.2.3 BigInt.prototype

BigInt.prototype의 initial value는 BigInt prototype object입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

21.2.3 Properties of the BigInt Prototype Object

BigInt prototype object는:

  • %BigInt.prototype%입니다.
  • ordinary object입니다.
  • BigInt object가 아닙니다; [[BigIntData]] internal slot을 가지지 않습니다.
  • value가 %Object.prototype%[[Prototype]] internal slot을 가집니다.

method specification 안의 phrase “this BigInt value”는 method invocation의 this value를 argument로 pass하여 abstract operation ThisBigIntValue를 calling한 result를 refer합니다.

21.2.3.1 BigInt.prototype.constructor

BigInt.prototype.constructor의 initial value는 %BigInt%입니다.

21.2.3.2 BigInt.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )

ECMA-402 Internationalization API를 include하는 ECMAScript implementation은 ECMA-402 specification에 specified된 대로 이 method를 implement해야 합니다. ECMAScript implementation이 ECMA-402 API를 include하지 않으면 이 method의 다음 specification이 사용됩니다:

이 method는 host environment의 current locale의 convention에 따라 formatted된 this BigInt value를 represent하는 String value를 produce합니다. 이 method는 implementation-defined이며, toString과 same thing을 return하는 것이 permissible하지만 encouraged되지는 않습니다.

이 method의 optional parameter의 meaning은 ECMA-402 specification에 defined되어 있습니다; ECMA-402 support를 include하지 않는 implementation은 those parameter position을 anything else에 사용해서는 안 됩니다.

21.2.3.3 BigInt.prototype.toString ( [ radix ] )

Note

optional radix2𝔽부터 36𝔽까지의 inclusive interval 안에 있는 integral Number value여야 합니다. radixundefined이면 10𝔽radix의 value로 사용됩니다.

이 method는 called될 때 다음 step을 수행합니다:

  1. x를 ? ThisBigIntValue(this value)로 둔다.
  2. radixundefined이면, radixMV를 10으로 둔다.
  3. 그렇지 않으면, radixMV를 ? ToIntegerOrInfinity(radix)로 둔다.
  4. radixMV가 2부터 36까지의 inclusive interval 안에 있지 않으면, RangeError exception을 throw한다.
  5. BigInt::toString(x, radixMV)를 반환한다.

이 method는 generic하지 않습니다; this value가 BigInt 또는 BigInt object가 아니면 TypeError exception을 throw합니다. 따라서 method로 사용하기 위해 다른 kind의 object로 transferred될 수 없습니다.

21.2.3.4 BigInt.prototype.valueOf ( )

  1. ThisBigIntValue(this value)를 반환한다.

21.2.3.4.1 ThisBigIntValue ( arg )

The abstract operation ThisBigIntValue takes argument arg (an ECMAScript language value) and returns either a normal completion containing a BigInt or a throw completion. It performs the following steps when called:

  1. arg가 BigInt이면, arg를 반환한다.
  2. arg가 Object이고 arg[[BigIntData]] internal slot을 가지면, 다음을 수행한다.
    1. Assert: arg.[[BigIntData]]는 BigInt이다.
    2. arg.[[BigIntData]]를 반환한다.
  3. TypeError exception을 throw한다.

21.2.3.5 BigInt.prototype [ %Symbol.toStringTag% ]

%Symbol.toStringTag% property의 initial value는 String value "BigInt"입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }를 가집니다.

21.2.4 Properties of BigInt Instances

BigInt instance는 BigInt prototype object에서 property를 inherit하는 ordinary object입니다. BigInt instance는 또한 [[BigIntData]] internal slot을 가집니다. [[BigIntData]] internal slot은 이 BigInt object가 represented하는 BigInt value입니다.

21.3 The Math Object

Math object는:

  • %Math%입니다.
  • global object"Math" property의 initial value입니다.
  • ordinary object입니다.
  • value가 %Object.prototype%[[Prototype]] internal slot을 가집니다.
  • function object가 아닙니다.
  • [[Construct]] internal method를 가지지 않습니다; new operator와 함께 constructor로 사용될 수 없습니다.
  • [[Call]] internal method를 가지지 않습니다; function으로 invoked될 수 없습니다.
Note

이 specification에서 phrase “the Number value for x”는 6.1.6.1에 defined된 technical meaning을 가집니다.

21.3.1 Value Properties of the Math Object

21.3.1.1 Math.E

natural logarithm의 base인 e에 대한 Number value이며, 이는 approximately 2.7182818284590452354입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

21.3.1.2 Math.LN10

10의 natural logarithm에 대한 Number value이며, 이는 approximately 2.302585092994046입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

21.3.1.3 Math.LN2

2의 natural logarithm에 대한 Number value이며, 이는 approximately 0.6931471805599453입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

21.3.1.4 Math.LOG10E

natural logarithm의 base인 e의 base-10 logarithm에 대한 Number value입니다; 이 value는 approximately 0.4342944819032518입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

Note

Math.LOG10E의 value는 Math.LN10의 value의 reciprocal에 approximate합니다.

21.3.1.5 Math.LOG2E

natural logarithm의 base인 e의 base-2 logarithm에 대한 Number value입니다; 이 value는 approximately 1.4426950408889634입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

Note

Math.LOG2E의 value는 Math.LN2의 value의 reciprocal에 approximate합니다.

21.3.1.6 Math.PI

circle의 circumference와 diameter의 ratio인 π에 대한 Number value이며, 이는 approximately 3.1415926535897932입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

21.3.1.7 Math.SQRT1_2

½의 square root에 대한 Number value이며, 이는 approximately 0.7071067811865476입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

Note

Math.SQRT1_2의 value는 Math.SQRT2의 value의 reciprocal에 approximate합니다.

21.3.1.8 Math.SQRT2

2의 square root에 대한 Number value이며, 이는 approximately 1.4142135623730951입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

21.3.1.9 Math [ %Symbol.toStringTag% ]

%Symbol.toStringTag% property의 initial value는 String value "Math"입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }를 가집니다.

21.3.2 Function Properties of the Math Object

Note

acos, acosh, asin, asinh, atan, atanh, atan2, cbrt, cos, cosh, exp, expm1, hypot, log, log1p, log2, log10, pow, random, sin, sinh, tan, 및 tanh function의 behaviour는 interest의 boundary case를 represent하는 certain argument value에 대해 specific result를 require하는 것 외에는 여기에서 precisely specified되지 않습니다. other argument value에 대해, these function은 familiar mathematical function의 result에 대한 approximation을 compute하도록 intended되지만, approximation algorithm 선택에는 some latitude가 allowed됩니다. general intent는 implementer가 given hardware platform에서 C programmer에게 available한 same mathematical library를 ECMAScript에 사용할 수 있게 하는 것입니다.

algorithm 선택은 implementation에 left되지만, implementation은 Sun Microsystems의 freely distributable mathematical library인 fdlibm(http://www.netlib.org/fdlibm)에 contained된 IEEE 754-2019 arithmetic을 위한 approximation algorithm을 사용할 것이 recommended됩니다(이 standard에 의해 specified되지는 않음).

21.3.2.1 Math.abs ( x )

이 function은 x의 absolute value를 반환합니다; result는 x와 same magnitude를 가지지만 positive sign을 가집니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN이면, NaN을 반환한다.
  3. n-0𝔽이면, +0𝔽를 반환한다.
  4. n-∞𝔽이면, +∞𝔽를 반환한다.
  5. n < -0𝔽이면, -n을 반환한다.
  6. n을 반환한다.

21.3.2.2 Math.acos ( x )

이 function은 x의 inverse cosine을 반환합니다. result는 radians로 expressed되며 +0𝔽부터 𝔽(π)까지의 inclusive interval 안에 있습니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN이거나, n > 1𝔽이거나, n < -1𝔽이면, NaN을 반환한다.
  3. n1𝔽이면, +0𝔽를 반환한다.
  4. (n)의 inverse cosine을 represent하는 implementation-approximated Number value를 반환한다.

21.3.2.3 Math.acosh ( x )

이 function은 x의 inverse hyperbolic cosine을 반환합니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN 또는 +∞𝔽 중 하나이면, n을 반환한다.
  3. n1𝔽이면, +0𝔽를 반환한다.
  4. n < 1𝔽이면, NaN을 반환한다.
  5. (n)의 inverse hyperbolic cosine을 represent하는 implementation-approximated Number value를 반환한다.

21.3.2.4 Math.asin ( x )

이 function은 x의 inverse sine을 반환합니다. result는 radians로 expressed되며 𝔽(-π / 2)부터 𝔽(π / 2)까지의 inclusive interval 안에 있습니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN, +0𝔽, 또는 -0𝔽 중 하나이면, n을 반환한다.
  3. n > 1𝔽 또는 n < -1𝔽이면, NaN을 반환한다.
  4. (n)의 inverse sine을 represent하는 implementation-approximated Number value를 반환한다.

21.3.2.5 Math.asinh ( x )

이 function은 x의 inverse hyperbolic sine을 반환합니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nfinite가 아니거나 n+0𝔽 또는 -0𝔽 중 하나이면, n을 반환한다.
  3. (n)의 inverse hyperbolic sine을 represent하는 implementation-approximated Number value를 반환한다.

21.3.2.6 Math.atan ( x )

이 function은 x의 inverse tangent를 반환합니다. result는 radians로 expressed되며 𝔽(-π / 2)부터 𝔽(π / 2)까지의 inclusive interval 안에 있습니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN, +0𝔽, 또는 -0𝔽 중 하나이면, n을 반환한다.
  3. n+∞𝔽이면, π / 2를 represent하는 implementation-approximated Number value를 반환한다.
  4. n-∞𝔽이면, -π / 2를 represent하는 implementation-approximated Number value를 반환한다.
  5. (n)의 inverse tangent를 represent하는 implementation-approximated Number value를 반환한다.

21.3.2.7 Math.atanh ( x )

이 function은 x의 inverse hyperbolic tangent를 반환합니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN, +0𝔽, 또는 -0𝔽 중 하나이면, n을 반환한다.
  3. n > 1𝔽 또는 n < -1𝔽이면, NaN을 반환한다.
  4. n1𝔽이면, +∞𝔽를 반환한다.
  5. n-1𝔽이면, -∞𝔽를 반환한다.
  6. (n)의 inverse hyperbolic tangent를 represent하는 implementation-approximated Number value를 반환한다.

21.3.2.8 Math.atan2 ( y, x )

이 function은 arguments yx의 quotient y / x의 inverse tangent를 반환하며, yx의 sign은 result의 quadrant를 determine하는 데 사용됩니다. two-argument inverse tangent function에서 y라는 argument가 first이고 x라는 argument가 second인 것은 intentional이며 traditional임에 note하십시오. result는 radians로 expressed되며 -π부터 +π까지의 inclusive interval 안에 있습니다.

called될 때 다음 step을 수행합니다:

  1. ny를 ? ToNumber(y)로 둔다.
  2. nx를 ? ToNumber(x)로 둔다.
  3. nyNaN이거나 nxNaN이면, NaN을 반환한다.
  4. ny+∞𝔽이면, 다음을 수행한다.
    1. nx+∞𝔽이면, π / 4를 represent하는 implementation-approximated Number value를 반환한다.
    2. nx-∞𝔽이면, 3π / 4를 represent하는 implementation-approximated Number value를 반환한다.
    3. π / 2를 represent하는 implementation-approximated Number value를 반환한다.
  5. ny-∞𝔽이면, 다음을 수행한다.
    1. nx+∞𝔽이면, -π / 4를 represent하는 implementation-approximated Number value를 반환한다.
    2. nx-∞𝔽이면, -3π / 4를 represent하는 implementation-approximated Number value를 반환한다.
    3. -π / 2를 represent하는 implementation-approximated Number value를 반환한다.
  6. ny+0𝔽이면, 다음을 수행한다.
    1. nx > +0𝔽이거나 nx+0𝔽이면, +0𝔽를 반환한다.
    2. π를 represent하는 implementation-approximated Number value를 반환한다.
  7. ny-0𝔽이면, 다음을 수행한다.
    1. nx > +0𝔽이거나 nx+0𝔽이면, -0𝔽를 반환한다.
    2. -π를 represent하는 implementation-approximated Number value를 반환한다.
  8. Assert: nyfinite이고 +0𝔽-0𝔽도 아니다.
  9. ny > +0𝔽이면, 다음을 수행한다.
    1. nx+∞𝔽이면, +0𝔽를 반환한다.
    2. nx-∞𝔽이면, π를 represent하는 implementation-approximated Number value를 반환한다.
    3. nx+0𝔽 또는 -0𝔽 중 하나이면, π / 2를 represent하는 implementation-approximated Number value를 반환한다.
  10. ny < -0𝔽이면, 다음을 수행한다.
    1. nx+∞𝔽이면, -0𝔽를 반환한다.
    2. nx-∞𝔽이면, -π를 represent하는 implementation-approximated Number value를 반환한다.
    3. nx+0𝔽 또는 -0𝔽 중 하나이면, -π / 2를 represent하는 implementation-approximated Number value를 반환한다.
  11. Assert: nxfinite이고 +0𝔽-0𝔽도 아니다.
  12. resultabs((ny) / (nx))의 inverse tangent로 둔다.
  13. nx < -0𝔽이면, 다음을 수행한다.
    1. ny > +0𝔽이면, result를 π - result로 설정한다.
    2. 그렇지 않으면, result를 -π + result로 설정한다.
  14. 그렇지 않으면,
    1. ny < -0𝔽이면, result를 -result로 설정한다.
  15. result를 represent하는 implementation-approximated Number value를 반환한다.

21.3.2.9 Math.cbrt ( x )

이 function은 x의 cube root를 반환합니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nfinite가 아니거나 n+0𝔽 또는 -0𝔽 중 하나이면, n을 반환한다.
  3. (n)의 cube root를 represent하는 implementation-approximated Number value를 반환한다.

21.3.2.10 Math.ceil ( x )

이 function은 x보다 less하지 않은 smallest(closest to -∞) integral Number value를 반환합니다. x가 already integral Number이면, result는 x입니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nfinite가 아니거나 n+0𝔽 또는 -0𝔽 중 하나이면, n을 반환한다.
  3. n < -0𝔽이고 n > -1𝔽이면, -0𝔽를 반환한다.
  4. nintegral Number이면, n을 반환한다.
  5. n보다 less하지 않은 smallest(closest to -∞) integral Number value를 반환한다.
Note

Math.ceil(x)의 value는 -Math.floor(-x)의 value와 same입니다.

21.3.2.11 Math.clz32 ( x )

이 function은 called될 때 다음 step을 수행합니다:

  1. n을 ? ToUint32(x)로 둔다.
  2. pn의 unsigned 32-bit binary representation 안의 leading zero bit 수로 둔다.
  3. 𝔽(p)를 반환한다.
Note

n+0𝔽 또는 -0𝔽 중 하나이면, 이 method는 32𝔽를 반환합니다. n의 32-bit binary encoding의 most significant bit가 1이면, 이 method는 +0𝔽를 반환합니다.

21.3.2.12 Math.cos ( x )

이 function은 x의 cosine을 반환합니다. argument는 radians로 expressed됩니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nfinite가 아니면, NaN을 반환한다.
  3. n+0𝔽 또는 -0𝔽 중 하나이면, 1𝔽를 반환한다.
  4. (n)의 cosine을 represent하는 implementation-approximated Number value를 반환한다.

21.3.2.13 Math.cosh ( x )

이 function은 x의 hyperbolic cosine을 반환합니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN이면, NaN을 반환한다.
  3. n+∞𝔽 또는 -∞𝔽 중 하나이면, +∞𝔽를 반환한다.
  4. n+0𝔽 또는 -0𝔽 중 하나이면, 1𝔽를 반환한다.
  5. (n)의 hyperbolic cosine을 represent하는 implementation-approximated Number value를 반환한다.
Note

Math.cosh(x)의 value는 (Math.exp(x) + Math.exp(-x)) / 2의 value와 same입니다.

21.3.2.14 Math.exp ( x )

이 function은 x의 exponential function(e raised to the power of x, 여기서 e는 natural logarithm의 base)을 반환합니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN 또는 +∞𝔽 중 하나이면, n을 반환한다.
  3. n+0𝔽 또는 -0𝔽 중 하나이면, 1𝔽를 반환한다.
  4. n-∞𝔽이면, +0𝔽를 반환한다.
  5. (n)의 exponential function을 represent하는 implementation-approximated Number value를 반환한다.

21.3.2.15 Math.expm1 ( x )

이 function은 x의 exponential function(e raised to the power of x, 여기서 e는 natural logarithm의 base)에서 1을 subtract한 result를 반환합니다. result는 x의 value가 0에 close한 경우에도 accurate한 way로 computed됩니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN, +0𝔽, -0𝔽, 또는 +∞𝔽 중 하나이면, n을 반환한다.
  3. n-∞𝔽이면, -1𝔽를 반환한다.
  4. exp(n)의 exponential function으로 둔다.
  5. exp - 1을 represent하는 implementation-approximated Number value를 반환한다.

21.3.2.16 Math.floor ( x )

이 function은 x보다 greater하지 않은 greatest(closest to +∞) integral Number value를 반환합니다. x가 already integral Number이면, result는 x입니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nfinite가 아니거나 n+0𝔽 또는 -0𝔽 중 하나이면, n을 반환한다.
  3. n < 1𝔽이고 n > +0𝔽이면, +0𝔽를 반환한다.
  4. nintegral Number이면, n을 반환한다.
  5. n보다 greater하지 않은 greatest(closest to +∞) integral Number value를 반환한다.
Note

Math.floor(x)의 value는 -Math.ceil(-x)의 value와 same입니다.

21.3.2.17 Math.fround ( x )

이 function은 called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN이면, NaN을 반환한다.
  3. n+0𝔽, -0𝔽, +∞𝔽, 또는 -∞𝔽 중 하나이면, n을 반환한다.
  4. n32를 roundTiesToEven mode를 사용하여 nIEEE 754-2019 binary32 format으로 converting한 result로 둔다.
  5. n64n32IEEE 754-2019 binary64 format으로 converting한 result로 둔다.
  6. n64에 corresponding하는 ECMAScript Number value를 반환한다.

21.3.2.18 Math.f16round ( x )

이 function은 called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN이면, NaN을 반환한다.
  3. n+0𝔽, -0𝔽, +∞𝔽, 또는 -∞𝔽 중 하나이면, n을 반환한다.
  4. n16을 roundTiesToEven mode를 사용하여 nIEEE 754-2019 binary16 format으로 converting한 result로 둔다.
  5. n64n16IEEE 754-2019 binary64 format으로 converting한 result로 둔다.
  6. n64에 corresponding하는 ECMAScript Number value를 반환한다.
Note

이 operation은 double-rounding 가능성 때문에 binary32로 cast한 다음 binary16으로 cast하는 것과 same하지 않습니다: 예를 들어 number k = 1.00048828125000022204𝔽를 consider하면, Math.f16round(k)는 1.0009765625𝔽이지만, Math.f16round(Math.fround(k))는 1𝔽입니다.

모든 platform이 binary64에서 binary16으로 casting하는 native support를 provide하는 것은 아닙니다. 이를 provide할 수 있는 다양한 library가 있으며, 여기에는 MIT-licensed half library가 include됩니다. Alternatively, roundTiesToEven 하에서 binary64에서 binary32로 first cast한 다음 result가 incorrect double-rounding으로 이어질 수 있는지 check할 수 있습니다. such case는 binary32 value의 mantissa를 initial cast를 roundTiesToOdd 하에서 수행했을 때 produced될 value가 되도록 adjusting함으로써 explicitly handled될 수 있습니다. adjusted value를 roundTiesToEven 하에서 binary16으로 casting하면 correct value가 produced됩니다.

21.3.2.19 Math.hypot ( ...args )

zero or more arguments가 given되면, 이 function은 그 arguments의 squares의 sum의 square root를 반환합니다.

called될 때 다음 step을 수행합니다:

  1. coerced를 새 empty List로 둔다.
  2. args의 각 element arg에 대해, 다음을 수행한다.
    1. n을 ? ToNumber(arg)로 둔다.
    2. ncoerced에 append한다.
  3. coerced의 각 element number에 대해, 다음을 수행한다.
    1. number+∞𝔽 또는 -∞𝔽 중 하나이면, +∞𝔽를 반환한다.
  4. onlyZerotrue로 둔다.
  5. coerced의 각 element number에 대해, 다음을 수행한다.
    1. numberNaN이면, NaN을 반환한다.
    2. number+0𝔽-0𝔽도 아니면, onlyZerofalse로 설정한다.
  6. onlyZerotrue이면, +0𝔽를 반환한다.
  7. coerced의 element의 mathematical value의 squares의 sum의 square root를 represent하는 implementation-approximated Number value를 반환한다.

이 function의 "length" property는 2𝔽입니다.

Note

implementation은 이 function이 two or more arguments와 함께 called될 때 naive implementation에서 발생하기 쉬운 overflow 및 underflow로 인한 precision loss를 avoid하도록 care해야 합니다.

21.3.2.20 Math.imul ( x, y )

이 function은 called될 때 다음 step을 수행합니다:

  1. a(? ToUint32(x))로 둔다.
  2. b(? ToUint32(y))로 둔다.
  3. product를 (a × b) modulo 232로 둔다.
  4. product ≥ 231이면, 𝔽(product - 232)를 반환한다.
  5. 𝔽(product)를 반환한다.

21.3.2.21 Math.log ( x )

이 function은 x의 natural logarithm을 반환합니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN 또는 +∞𝔽 중 하나이면, n을 반환한다.
  3. n1𝔽이면, +0𝔽를 반환한다.
  4. n+0𝔽 또는 -0𝔽 중 하나이면, -∞𝔽를 반환한다.
  5. n < -0𝔽이면, NaN을 반환한다.
  6. ln((n))을 represent하는 implementation-approximated Number value를 반환한다.

21.3.2.22 Math.log1p ( x )

이 function은 1 + x의 natural logarithm을 반환합니다. result는 x의 value가 zero에 close한 경우에도 accurate한 way로 computed됩니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN, +0𝔽, -0𝔽, 또는 +∞𝔽 중 하나이면, n을 반환한다.
  3. n-1𝔽이면, -∞𝔽를 반환한다.
  4. n < -1𝔽이면, NaN을 반환한다.
  5. ln(1 + (n))을 represent하는 implementation-approximated Number value를 반환한다.

21.3.2.23 Math.log10 ( x )

이 function은 x의 base 10 logarithm을 반환합니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN 또는 +∞𝔽 중 하나이면, n을 반환한다.
  3. n1𝔽이면, +0𝔽를 반환한다.
  4. n+0𝔽 또는 -0𝔽 중 하나이면, -∞𝔽를 반환한다.
  5. n < -0𝔽이면, NaN을 반환한다.
  6. log10((n))을 represent하는 implementation-approximated Number value를 반환한다.

21.3.2.24 Math.log2 ( x )

이 function은 x의 base 2 logarithm을 반환합니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN 또는 +∞𝔽 중 하나이면, n을 반환한다.
  3. n1𝔽이면, +0𝔽를 반환한다.
  4. n+0𝔽 또는 -0𝔽 중 하나이면, -∞𝔽를 반환한다.
  5. n < -0𝔽이면, NaN을 반환한다.
  6. log2((n))를 represent하는 implementation-approximated Number value를 반환한다.

21.3.2.25 Math.max ( ...args )

zero or more arguments가 given되면, 이 function은 각 argument에 ToNumber를 call하고 resulting value 중 largest를 반환합니다.

called될 때 다음 step을 수행합니다:

  1. coerced를 새 empty List로 둔다.
  2. args의 각 element arg에 대해, 다음을 수행한다.
    1. n을 ? ToNumber(arg)로 둔다.
    2. ncoerced에 append한다.
  3. highest-∞𝔽로 둔다.
  4. coerced의 각 element number에 대해, 다음을 수행한다.
    1. numberNaN이면, NaN을 반환한다.
    2. number+0𝔽이고 highest-0𝔽이면, highest+0𝔽로 설정한다.
    3. number > highest이면, highestnumber로 설정한다.
  5. highest를 반환한다.
Note

largest value를 determine하기 위한 value comparison은 +0𝔽-0𝔽보다 larger로 considered된다는 점을 제외하고 IsLessThan algorithm을 사용하여 수행됩니다.

이 function의 "length" property는 2𝔽입니다.

21.3.2.26 Math.min ( ...args )

zero or more arguments가 given되면, 이 function은 각 argument에 ToNumber를 call하고 resulting value 중 smallest를 반환합니다.

called될 때 다음 step을 수행합니다:

  1. coerced를 새 empty List로 둔다.
  2. args의 각 element arg에 대해, 다음을 수행한다.
    1. n을 ? ToNumber(arg)로 둔다.
    2. ncoerced에 append한다.
  3. lowest+∞𝔽로 둔다.
  4. coerced의 각 element number에 대해, 다음을 수행한다.
    1. numberNaN이면, NaN을 반환한다.
    2. number-0𝔽이고 lowest+0𝔽이면, lowest-0𝔽로 설정한다.
    3. number < lowest이면, lowestnumber로 설정한다.
  5. lowest를 반환한다.
Note

smallest value를 determine하기 위한 value comparison은 +0𝔽-0𝔽보다 larger로 considered된다는 점을 제외하고 IsLessThan algorithm을 사용하여 수행됩니다.

이 function의 "length" property는 2𝔽입니다.

21.3.2.27 Math.pow ( base, exponent )

이 function은 called될 때 다음 step을 수행합니다:

  1. base를 ? ToNumber(base)로 설정한다.
  2. exponent를 ? ToNumber(exponent)로 설정한다.
  3. Number::exponentiate(base, exponent)를 반환한다.

21.3.2.28 Math.random ( )

이 function은 positive sign을 가지고, +0𝔽보다 크거나 같지만 1𝔽보다 strictly less한 Number value를 반환하며, 이는 implementation-defined algorithm 또는 strategy를 사용하여 해당 range에서 approximately uniform distribution으로 randomly 또는 pseudo randomly chosen됩니다.

distinct realm을 위해 created된 각 Math.random function은 successive call에서 distinct sequence of values를 produce해야 합니다.

21.3.2.29 Math.round ( x )

이 function은 x에 closest하고 integral인 Number value를 반환합니다. two integral Numbersx에 equally close하면, result는 +∞에 closer한 Number value입니다. x가 already integral이면, result는 x입니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nfinite가 아니거나 nintegral Number이면, n을 반환한다.
  3. n < 0.5𝔽이고 n > +0𝔽이면, +0𝔽를 반환한다.
  4. n < -0𝔽이고 n-0.5𝔽이면, -0𝔽를 반환한다.
  5. tie의 경우 +∞에 closer한 Number를 preferring하여, n에 closest한 integral Number를 반환한다.
Note 1

Math.round(3.5)는 4를 반환하지만, Math.round(-3.5)는 -3을 반환합니다.

Note 2

Math.round(x)의 value는 always Math.floor(x + 0.5)의 value와 same하지 않습니다. x-0𝔽이거나 x-0𝔽보다 less하지만 -0.5𝔽보다 greater than or equal to인 경우, Math.round(x)-0𝔽를 반환하지만, Math.floor(x + 0.5)+0𝔽를 반환합니다. Math.round(x)x + 0.5를 computing할 때 internal rounding 때문에 Math.floor(x + 0.5)의 value와 differ할 수도 있습니다.

21.3.2.30 Math.sign ( x )

이 function은 x의 sign을 반환하여, x가 positive, negative, 또는 zero인지를 indicate합니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN, +0𝔽, 또는 -0𝔽 중 하나이면, n을 반환한다.
  3. n < -0𝔽이면, -1𝔽를 반환한다.
  4. 1𝔽를 반환한다.

21.3.2.31 Math.sin ( x )

이 function은 x의 sine을 반환합니다. argument는 radians로 expressed됩니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN, +0𝔽, 또는 -0𝔽 중 하나이면, n을 반환한다.
  3. n+∞𝔽 또는 -∞𝔽 중 하나이면, NaN을 반환한다.
  4. (n)의 sine을 represent하는 implementation-approximated Number value를 반환한다.

21.3.2.32 Math.sinh ( x )

이 function은 x의 hyperbolic sine을 반환합니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nfinite가 아니거나 n+0𝔽 또는 -0𝔽 중 하나이면, n을 반환한다.
  3. (n)의 hyperbolic sine을 represent하는 implementation-approximated Number value를 반환한다.
Note

Math.sinh(x)의 value는 (Math.exp(x) - Math.exp(-x)) / 2의 value와 same입니다.

21.3.2.33 Math.sqrt ( x )

이 function은 x의 square root를 반환합니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN, +0𝔽, -0𝔽, 또는 +∞𝔽 중 하나이면, n을 반환한다.
  3. n < -0𝔽이면, NaN을 반환한다.
  4. 𝔽((n)의 square root)를 반환한다.

21.3.2.34 Math.sumPrecise ( items )

Numbers의 iterable이 given되면, 이 function은 iterable 안의 각 value를 sum하고 그 sum을 반환합니다. any value가 Number가 아니면 TypeError exception을 throw합니다.

called될 때 다음 step을 수행합니다:

  1. RequireObjectCoercible(items)를 수행한다.
  2. iteratorRecord를 ? GetIterator(items, sync)로 둔다.
  3. stateminus-zero로 둔다.
  4. sum을 0으로 둔다.
  5. count를 0으로 둔다.
  6. nextnot-started로 둔다.
  7. Repeat, nextdone이 아닌 동안,
    1. next를 ? IteratorStepValue(iteratorRecord)로 설정한다.
    2. nextdone이 아니면, 다음을 수행한다.
      1. count ≥ 253 - 1이면, 다음을 수행한다.
        1. NOTE: 이 step은 practice에서 reached될 것으로 expected되지 않으며, implementation이 이 specification을 violating하지 않고 input이 “reasonably sized”라고 rely할 수 있도록 하기 위해서만 included된다.
        2. errorThrowCompletion(newly created RangeError object)로 둔다.
        3. IteratorClose(iteratorRecord, error)를 반환한다.
      2. next가 Number가 아니면, 다음을 수행한다.
        1. errorThrowCompletion(newly created TypeError object)로 둔다.
        2. IteratorClose(iteratorRecord, error)를 반환한다.
      3. nnext로 둔다.
      4. statenot-a-number가 아니면, 다음을 수행한다.
        1. nNaN이면, 다음을 수행한다.
          1. statenot-a-number로 설정한다.
        2. 그렇지 않고 n+∞𝔽이면, 다음을 수행한다.
          1. stateminus-infinity이면, statenot-a-number로 설정한다.
          2. 그렇지 않으면, stateplus-infinity로 설정한다.
        3. 그렇지 않고 n-∞𝔽이면, 다음을 수행한다.
          1. stateplus-infinity이면, statenot-a-number로 설정한다.
          2. 그렇지 않으면, stateminus-infinity로 설정한다.
        4. 그렇지 않고 n-0𝔽가 아니며 stateminus-zero 또는 finite 중 하나이면, 다음을 수행한다.
          1. statefinite로 설정한다.
          2. sumsum + (n)으로 설정한다.
      5. countcount + 1로 설정한다.
  8. statenot-a-number이면, NaN을 반환한다.
  9. stateplus-infinity이면, +∞𝔽를 반환한다.
  10. stateminus-infinity이면, -∞𝔽를 반환한다.
  11. stateminus-zero이면, -0𝔽를 반환한다.
  12. 𝔽(sum)을 반환한다.
Note

sum의 value는 다양한 algorithm을 통해 arbitrary-precision arithmetic 없이 computed될 수 있습니다. 그중 하나는 Jonathan Richard Shewchuk의 Adaptive Precision Floating-Point Arithmetic and Fast Robust Geometric Predicates에 given된 “Grow-Expansion” algorithm입니다. 더 recent한 algorithm은 “Fast exact summation using small and large superaccumulators”에 given되어 있으며, 그 code는 https://gitlab.com/radfordneal/xsum에서 available합니다.

21.3.2.35 Math.tan ( x )

이 function은 x의 tangent를 반환합니다. argument는 radians로 expressed됩니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN, +0𝔽, 또는 -0𝔽 중 하나이면, n을 반환한다.
  3. n+∞𝔽 또는 -∞𝔽 중 하나이면, NaN을 반환한다.
  4. (n)의 tangent를 represent하는 implementation-approximated Number value를 반환한다.

21.3.2.36 Math.tanh ( x )

이 function은 x의 hyperbolic tangent를 반환합니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nNaN, +0𝔽, 또는 -0𝔽 중 하나이면, n을 반환한다.
  3. n+∞𝔽이면, 1𝔽를 반환한다.
  4. n-∞𝔽이면, -1𝔽를 반환한다.
  5. (n)의 hyperbolic tangent를 represent하는 implementation-approximated Number value를 반환한다.
Note

Math.tanh(x)의 value는 (Math.exp(x) - Math.exp(-x)) / (Math.exp(x) + Math.exp(-x))의 value와 same입니다.

21.3.2.37 Math.trunc ( x )

이 function은 fractional digit을 제거하여 number x의 integral part를 반환합니다. x가 already integral이면, result는 x입니다.

called될 때 다음 step을 수행합니다:

  1. n을 ? ToNumber(x)로 둔다.
  2. nfinite가 아니거나 n+0𝔽 또는 -0𝔽 중 하나이면, n을 반환한다.
  3. n < 1𝔽이고 n > +0𝔽이면, +0𝔽를 반환한다.
  4. n < -0𝔽이고 n > -1𝔽이면, -0𝔽를 반환한다.
  5. +0𝔽의 direction으로 n에 nearest한 integral Number를 반환한다.

21.4 Date Objects

21.4.1 Overview of Date Objects and Definitions of Abstract Operations

다음 abstract operation은 time value(21.4.1.1에서 defined됨)에 대해 operate합니다. 모든 경우에, 이러한 function 중 하나에 대한 any argument가 NaN이면 result는 NaN이 된다는 점에 note하십시오.

21.4.1.1 Time Values and Time Range

ECMAScript의 time measurement는 POSIX의 time measurement와 analogous하며, 특히 proleptic Gregorian calendar, 1970년 1월 1일 UTC 시작 시점의 midnight인 epoch, 그리고 every day가 정확히 86,400초(각각 1000 milliseconds 길이)로 구성된다는 accounting을 공유합니다.

ECMAScript time value는 Number이며, millisecond precision으로 time 안의 instant를 represent하는 finite integral Number이거나 specific instant가 없음을 represent하는 NaN입니다. 24 × 60 × 60 × 1000 = 86,400,000의 multiple인 time value(즉 어떤 integer d에 대해 86,400,000 × d)는 epoch 뒤에 d whole UTC days만큼 따르는 UTC day의 start instant를 represent합니다(negative d의 경우 epoch 앞). every other finite time value tv는 그러한 multiple인 greatest preceding time value s를 기준으로 defined되며, s와 same UTC day 안에서 occur하지만 (tv - s) milliseconds만큼 뒤따르는 instant를 represent합니다.

Time value는 UTC leap second를 account하지 않습니다—positive leap second 안의 instant를 represent하는 time value는 없고, negative leap second에 의해 UTC timeline에서 removed된 instant를 represent하는 time value가 있습니다. 그러나 time value의 definition은 nonetheless UTC와 piecewise alignment를 yield하며, discontinuity는 leap second boundary에서만 존재하고 leap second 밖에서는 zero difference입니다.

Number는 -9,007,199,254,740,992부터 9,007,199,254,740,992까지의 모든 integer를 exactly represent할 수 있습니다(21.1.2.821.1.2.6). time value는 -8,640,000,000,000,000부터 8,640,000,000,000,000 milliseconds까지의 slightly smaller range를 support합니다. 이는 1970년 1월 1일 UTC 시작 시점의 midnight를 기준으로 exactly -100,000,000 days부터 100,000,000 days까지의 supported time value range를 yield합니다.

1970년 1월 1일 UTC 시작 시점의 midnight의 exact moment는 time value +0𝔽로 represented됩니다.

Note

proleptic Gregorian calendar에서 leap year는 4로 divisible하면서 400으로 divisible하거나 100으로 divisible하지 않는 year입니다.

proleptic Gregorian calendar의 400 year cycle은 97 leap years를 contain합니다. 이는 year당 average 365.2425 days를 yield하며, 이는 31,556,952,000 milliseconds입니다. 따라서 Number가 millisecond precision으로 exactly represent할 수 있는 maximum range는 1970을 기준으로 approximately -285,426부터 285,426 years까지입니다. 이 section에 specified된 time value가 support하는 smaller range는 1970을 기준으로 approximately -273,790부터 273,790 years까지입니다.

21.4.1.2 Time-related Constants

이러한 constant는 following sections의 algorithm에서 referenced됩니다.

HoursPerDay = 24
MinutesPerHour = 60
SecondsPerMinute = 60
msPerSecond = 1000𝔽
msPerMinute = 60000𝔽 = msPerSecond × 𝔽(SecondsPerMinute)
msPerHour = 3600000𝔽 = msPerMinute × 𝔽(MinutesPerHour)
msPerDay = 86400000𝔽 = msPerHour × 𝔽(HoursPerDay)

21.4.1.3 Day ( tv )

The abstract operation Day takes argument tv (a finite time value) and returns an integral Number. tv가 fall하는 day의 day number를 반환합니다. It performs the following steps when called:

  1. 𝔽(floor((tv / msPerDay)))를 반환한다.

21.4.1.4 TimeWithinDay ( tv )

The abstract operation TimeWithinDay takes argument tv (a finite time value) and returns an integral Number in the interval from +0𝔽 (inclusive) to msPerDay (exclusive). tv가 fall하는 day의 start 이후 milliseconds 수를 반환합니다. It performs the following steps when called:

  1. 𝔽((tv) modulo (msPerDay))를 반환한다.

21.4.1.5 DaysInYear ( y )

The abstract operation DaysInYear takes argument y (an integral Number) and returns 365𝔽 or 366𝔽. year y 안의 days 수를 반환합니다. Leap year는 366 days를 가지고, all other years는 365를 가집니다. It performs the following steps when called:

  1. ry(y)로 둔다.
  2. (ry modulo 400) = 0이면, 366𝔽를 반환한다.
  3. (ry modulo 100) = 0이면, 365𝔽를 반환한다.
  4. (ry modulo 4) = 0이면, 366𝔽를 반환한다.
  5. 365𝔽를 반환한다.

21.4.1.6 DayFromYear ( y )

The abstract operation DayFromYear takes argument y (an integral Number) and returns an integral Number. year y의 first day의 day number를 반환합니다. It performs the following steps when called:

  1. ry(y)로 둔다.
  2. NOTE: following steps에서 numberYears1, numberYears4, numberYears100, 및 numberYears400은 각각 1, 4, 100, 및 400으로 divisible한 years의 number이며, epoch와 year y의 start 사이에 occur합니다. yepoch보다 before이면 number는 negative입니다.
  3. numberYears1을 (ry - 1970)으로 둔다.
  4. numberYears4floor((ry - 1969) / 4)로 둔다.
  5. numberYears100floor((ry - 1901) / 100)으로 둔다.
  6. numberYears400floor((ry - 1601) / 400)으로 둔다.
  7. 𝔽(365 × numberYears1 + numberYears4 - numberYears100 + numberYears400)를 반환한다.

21.4.1.7 TimeFromYear ( y )

The abstract operation TimeFromYear takes argument y (an integral Number) and returns a time value. year y의 start의 time value를 반환합니다. It performs the following steps when called:

  1. msPerDay × DayFromYear(y)를 반환한다.

21.4.1.8 YearFromTime ( tv )

The abstract operation YearFromTime takes argument tv (a finite time value) and returns an integral Number. tv가 fall하는 year를 반환합니다. It performs the following steps when called:

  1. TimeFromYear(y) ≤ tv인 largest integral Number y (closest to +∞)를 반환한다.

21.4.1.9 DayWithinYear ( tv )

The abstract operation DayWithinYear takes argument tv (a finite time value) and returns an integral Number in the inclusive interval from +0𝔽 to 365𝔽. It performs the following steps when called:

  1. Day(tv) - DayFromYear(YearFromTime(tv))를 반환한다.

21.4.1.10 InLeapYear ( tv )

The abstract operation InLeapYear takes argument tv (a finite time value) and returns +0𝔽 or 1𝔽. tv가 leap year 안에 있으면 1𝔽를 반환하고 otherwise +0𝔽를 반환합니다. It performs the following steps when called:

  1. DaysInYear(YearFromTime(tv))가 366𝔽이면, 1𝔽를 반환한다.
  2. +0𝔽를 반환한다.

21.4.1.11 MonthFromTime ( tv )

The abstract operation MonthFromTime takes argument tv (a finite time value) and returns an integral Number in the inclusive interval from +0𝔽 to 11𝔽. tv가 fall하는 month를 identifying하는 Number를 반환합니다. month value +0𝔽는 January를 specify합니다; 1𝔽는 February를 specify합니다; 2𝔽는 March를 specify합니다; 3𝔽는 April을 specify합니다; 4𝔽는 May를 specify합니다; 5𝔽는 June을 specify합니다; 6𝔽는 July를 specify합니다; 7𝔽는 August를 specify합니다; 8𝔽는 September를 specify합니다; 9𝔽는 October를 specify합니다; 10𝔽는 November를 specify합니다; 그리고 11𝔽는 December를 specify합니다. MonthFromTime(+0𝔽) = +0𝔽이며, 이는 1970년 1월 1일 목요일에 corresponding함에 note하십시오. It performs the following steps when called:

  1. inLeapYearInLeapYear(tv)로 둔다.
  2. dayWithinYearDayWithinYear(tv)로 둔다.
  3. dayWithinYear < 31𝔽이면, +0𝔽를 반환한다.
  4. dayWithinYear < 59𝔽 + inLeapYear이면, 1𝔽를 반환한다.
  5. dayWithinYear < 90𝔽 + inLeapYear이면, 2𝔽를 반환한다.
  6. dayWithinYear < 120𝔽 + inLeapYear이면, 3𝔽를 반환한다.
  7. dayWithinYear < 151𝔽 + inLeapYear이면, 4𝔽를 반환한다.
  8. dayWithinYear < 181𝔽 + inLeapYear이면, 5𝔽를 반환한다.
  9. dayWithinYear < 212𝔽 + inLeapYear이면, 6𝔽를 반환한다.
  10. dayWithinYear < 243𝔽 + inLeapYear이면, 7𝔽를 반환한다.
  11. dayWithinYear < 273𝔽 + inLeapYear이면, 8𝔽를 반환한다.
  12. dayWithinYear < 304𝔽 + inLeapYear이면, 9𝔽를 반환한다.
  13. dayWithinYear < 334𝔽 + inLeapYear이면, 10𝔽를 반환한다.
  14. Assert: dayWithinYear < 365𝔽 + inLeapYear이다.
  15. 11𝔽를 반환한다.

21.4.1.12 DateFromTime ( tv )

The abstract operation DateFromTime takes argument tv (a finite time value) and returns an integral Number in the inclusive interval from 1𝔽 to 31𝔽. tv가 fall하는 month의 day를 반환합니다. It performs the following steps when called:

  1. inLeapYearInLeapYear(tv)로 둔다.
  2. dayWithinYearDayWithinYear(tv)로 둔다.
  3. monthMonthFromTime(tv)로 둔다.
  4. month+0𝔽이면, dayWithinYear + 1𝔽를 반환한다.
  5. month1𝔽이면, dayWithinYear - 30𝔽를 반환한다.
  6. month2𝔽이면, dayWithinYear - 58𝔽 - inLeapYear를 반환한다.
  7. month3𝔽이면, dayWithinYear - 89𝔽 - inLeapYear를 반환한다.
  8. month4𝔽이면, dayWithinYear - 119𝔽 - inLeapYear를 반환한다.
  9. month5𝔽이면, dayWithinYear - 150𝔽 - inLeapYear를 반환한다.
  10. month6𝔽이면, dayWithinYear - 180𝔽 - inLeapYear를 반환한다.
  11. month7𝔽이면, dayWithinYear - 211𝔽 - inLeapYear를 반환한다.
  12. month8𝔽이면, dayWithinYear - 242𝔽 - inLeapYear를 반환한다.
  13. month9𝔽이면, dayWithinYear - 272𝔽 - inLeapYear를 반환한다.
  14. month10𝔽이면, dayWithinYear - 303𝔽 - inLeapYear를 반환한다.
  15. Assert: month11𝔽이다.
  16. dayWithinYear - 333𝔽 - inLeapYear를 반환한다.

21.4.1.13 WeekDay ( tv )

The abstract operation WeekDay takes argument tv (a finite time value) and returns an integral Number in the inclusive interval from +0𝔽 to 6𝔽. tv가 fall하는 week의 day를 identifying하는 Number를 반환합니다. weekday value +0𝔽는 Sunday를 specify합니다; 1𝔽는 Monday를 specify합니다; 2𝔽는 Tuesday를 specify합니다; 3𝔽는 Wednesday를 specify합니다; 4𝔽는 Thursday를 specify합니다; 5𝔽는 Friday를 specify합니다; 그리고 6𝔽는 Saturday를 specify합니다. WeekDay(+0𝔽) = 4𝔽이며, 이는 1970년 1월 1일 목요일에 corresponding함에 note하십시오. It performs the following steps when called:

  1. 𝔽((Day(tv) + 4𝔽) modulo 7)를 반환한다.

21.4.1.14 HourFromTime ( tv )

The abstract operation HourFromTime takes argument tv (a finite time value) and returns an integral Number in the inclusive interval from +0𝔽 to 23𝔽. tv가 fall하는 day의 hour를 반환합니다. It performs the following steps when called:

  1. 𝔽(floor((tv / msPerHour)) modulo HoursPerDay)를 반환한다.

21.4.1.15 MinFromTime ( tv )

The abstract operation MinFromTime takes argument tv (a finite time value) and returns an integral Number in the inclusive interval from +0𝔽 to 59𝔽. tv가 fall하는 hour의 minute를 반환합니다. It performs the following steps when called:

  1. 𝔽(floor((tv / msPerMinute)) modulo MinutesPerHour)를 반환한다.

21.4.1.16 SecFromTime ( tv )

The abstract operation SecFromTime takes argument tv (a finite time value) and returns an integral Number in the inclusive interval from +0𝔽 to 59𝔽. tv가 fall하는 minute의 second를 반환합니다. It performs the following steps when called:

  1. 𝔽(floor((tv / msPerSecond)) modulo SecondsPerMinute)를 반환한다.

21.4.1.17 msFromTime ( tv )

The abstract operation msFromTime takes argument tv (a finite time value) and returns an integral Number in the inclusive interval from +0𝔽 to 999𝔽. tv가 fall하는 second의 millisecond를 반환합니다. It performs the following steps when called:

  1. 𝔽((tv) modulo (msPerSecond))를 반환한다.

21.4.1.18 GetUTCEpochNanoseconds ( year, month, day, hour, minute, second, millisecond, microsecond, nanosecond )

The abstract operation GetUTCEpochNanoseconds takes arguments year (an integer), month (an integer in the inclusive interval from 1 to 12), day (an integer in the inclusive interval from 1 to 31), hour (an integer in the inclusive interval from 0 to 23), minute (an integer in the inclusive interval from 0 to 59), second (an integer in the inclusive interval from 0 to 59), millisecond (an integer in the inclusive interval from 0 to 999), microsecond (an integer in the inclusive interval from 0 to 999), and nanosecond (an integer in the inclusive interval from 0 to 999) and returns a BigInt. returned value는 UTC에서 given ISO 8601 calendar date 및 wall-clock time에 corresponding하는 epoch 이후 nanoseconds 수를 represent합니다. It performs the following steps when called:

  1. dateMakeDay(𝔽(year), 𝔽(month - 1), 𝔽(day))로 둔다.
  2. timeMakeTime(𝔽(hour), 𝔽(minute), 𝔽(second), 𝔽(millisecond))로 둔다.
  3. msMakeDate(date, time)로 둔다.
  4. Assert: msintegral Number이다.
  5. ((ms) × 106 + microsecond × 103 + nanosecond)를 반환한다.

21.4.1.19 시간대 식별자

ECMAScript의 시간대는 시간대 식별자로 표현되며, 이는 0x0000부터 0x007F까지의 닫힌 구간에 있는 코드 유닛으로만 구성된 String이다. ECMAScript 구현체가 지원하는 시간대는 AvailableNamedTimeZoneIdentifiers가 반환하는 시간대 식별자 레코드의 [[Identifier]] 필드로 표현되는 사용 가능한 이름 있는 시간대이거나, IsTimeZoneOffsetStringtrue를 반환하는 String으로 표현되는 오프셋 시간대일 수 있다.

주 시간대 식별자는 사용 가능한 이름 있는 시간대에 대한 선호 식별자이다. 비주 시간대 식별자는 주 시간대 식별자가 아닌, 사용 가능한 이름 있는 시간대에 대한 식별자이다. 사용 가능한 이름 있는 시간대 식별자는 주 시간대 식별자 또는 비주 시간대 식별자 중 하나이다. 각 사용 가능한 이름 있는 시간대 식별자는 정확히 하나의 사용 가능한 이름 있는 시간대와 연관된다. 각 사용 가능한 이름 있는 시간대는 정확히 하나의 주 시간대 식별자와 0개 이상의 비주 시간대 식별자와 연관된다.

ECMAScript 구현체는 식별자 "UTC"를 가지는 사용 가능한 이름 있는 시간대를 지원해야 하며, 이는 UTC 시간대의 주 시간대 식별자여야 한다. 또한, 구현체는 임의 개수의 다른 사용 가능한 이름 있는 시간대를 지원할 수 있다.

ECMA-402 국제화 API 명세에 설명된 시간대 요구사항을 따르는 구현체를 시간대 인식이라고 한다. 시간대 인식 구현체는 IANA Time Zone Database의 Zone 및 Link 이름에 해당하는 사용 가능한 이름 있는 시간대를 지원해야 하며, 그러한 이름만 지원해야 한다. 시간대 인식 구현체에서, ECMA-402 명세에 명시된 AvailableNamedTimeZoneIdentifiers에 의해 특별히 재정의된 경우를 제외하고, 주 시간대 식별자는 IANA Time Zone Database의 Zone 이름이고, 비주 시간대 식별자는 각각 Link 이름이다. 전체 IANA Time Zone Database를 지원하지 않는 구현체도 시간대를 표현하는 식별자로 IANA Time Zone Database 이름을 사용하는 것이 권장된다.

21.4.1.20 GetNamedTimeZoneEpochNanoseconds ( timeZoneIdentifier, year, month, day, hour, minute, second, millisecond, microsecond, nanosecond )

The implementation-defined abstract operation GetNamedTimeZoneEpochNanoseconds takes arguments timeZoneIdentifier (a String), year (an integer), month (an integer in the inclusive interval from 1 to 12), day (an integer in the inclusive interval from 1 to 31), hour (an integer in the inclusive interval from 0 to 23), minute (an integer in the inclusive interval from 0 to 59), second (an integer in the inclusive interval from 0 to 59), millisecond (an integer in the inclusive interval from 0 to 999), microsecond (an integer in the inclusive interval from 0 to 999), and nanosecond (an integer in the inclusive interval from 0 to 999) and returns a List of BigInts. returned List 안의 각 value는 timeZoneIdentifier로 identified되는 named time zone에서 given ISO 8601 calendar date 및 wall-clock time에 corresponding하는 epoch 이후 nanoseconds 수를 represent합니다.

input이 negative time zone transition 때문에 more than once occur하는 local time을 represent할 때(예: daylight saving time이 끝나거나 time zone rule change 때문에 time zone offset이 decreased되는 경우), returned List는 more than one element를 가지며 ascending numerical value로 sorted됩니다. input이 positive time zone transition 때문에 skipped된 local time을 represent할 때(예: daylight saving time이 시작되거나 time zone rule change 때문에 time zone offset이 increased되는 경우), returned List는 empty입니다. Otherwise, returned List는 one element를 가집니다.

any time zone에 대한 local political rules를 include하지 않는 ECMAScript implementation에 사용될 GetNamedTimeZoneEpochNanoseconds의 default implementation은 called될 때 following steps를 수행합니다:

  1. Assert: timeZoneIdentifier"UTC"이다.
  2. epochNanosecondsGetUTCEpochNanoseconds(year, month, day, hour, minute, second, millisecond, microsecond, nanosecond)로 둔다.
  3. « epochNanoseconds »를 반환한다.
Note

time zone aware implementation에 대해 required되고(all others에도 recommended됨), IANA Time Zone Database https://www.iana.org/time-zones/의 time zone information을 사용해야 합니다.

America/New_York에서 2017년 11월 5일 1:30 AM은 twice repeated되므로, GetNamedTimeZoneEpochNanoseconds("America/New_York", 2017, 11, 5, 1, 30, 0, 0, 0, 0)는 length 2의 List를 반환할 것이며, first element는 05:30 UTC(UTC offset -04:00에서 01:30 US Eastern Daylight Time에 corresponding)를 represent하고 second element는 06:30 UTC(UTC offset -05:00에서 01:30 US Eastern Standard Time에 corresponding)를 represent합니다.

America/New_York에서 2017년 3월 12일 2:30 AM은 exist하지 않으므로, GetNamedTimeZoneEpochNanoseconds("America/New_York", 2017, 3, 12, 2, 30, 0, 0, 0, 0)는 empty List를 반환할 것입니다.

21.4.1.21 GetNamedTimeZoneOffsetNanoseconds ( timeZoneIdentifier, epochNanoseconds )

The implementation-defined abstract operation GetNamedTimeZoneOffsetNanoseconds takes arguments timeZoneIdentifier (a String) and epochNanoseconds (a BigInt) and returns an integer.

returned integerepoch를 기준으로 epochNanoseconds와 corresponding하는 instant에서 timeZoneIdentifier로 identified되는 named time zone의 UTC로부터의 offset을 nanoseconds 단위로 represent합니다.

any time zone에 대한 local political rules를 include하지 않는 ECMAScript implementation에 사용될 GetNamedTimeZoneOffsetNanoseconds의 default implementation은 called될 때 following steps를 수행합니다:

  1. Assert: timeZoneIdentifier"UTC"이다.
  2. 0을 반환한다.
Note

Time zone offset value는 positive 또는 negative일 수 있습니다.

21.4.1.22 Time Zone Identifier Record

Time Zone Identifier Recordavailable named time zone identifier와 그 corresponding primary time zone identifier를 describe하는 데 사용되는 Record입니다.

Time Zone Identifier Record는 Table 60에 listed된 field를 가집니다.

Table 60: Time Zone Identifier Record Fields
Field Name Value Meaning
[[Identifier]] a String implementation이 support하는 available named time zone identifier입니다.
[[PrimaryIdentifier]] a String [[Identifier]]가 resolve되는 primary time zone identifier입니다.
Note

[[Identifier]]가 primary time zone identifier이면, [[Identifier]][[PrimaryIdentifier]]입니다.

21.4.1.23 AvailableNamedTimeZoneIdentifiers ( )

The implementation-defined abstract operation AvailableNamedTimeZoneIdentifiers takes no arguments and returns a List of Time Zone Identifier Records. 그 result는 이 implementation의 모든 available named time zone identifier와 각 available named time zone identifier에 corresponding하는 primary time zone identifier를 describe합니다. List는 각 Time Zone Identifier Record[[Identifier]] field에 따라 ordered됩니다.

ECMA-402 Internationalization API를 implement하는 all implementation을 포함하여 time zone aware implementation은 ECMA-402 specification에 specified된 대로 AvailableNamedTimeZoneIdentifiers abstract operation을 implement해야 합니다. time zone aware가 아닌 implementation의 경우, AvailableNamedTimeZoneIdentifiers는 called될 때 following steps를 수행합니다:

  1. implementation이 any time zone에 대한 local political rules를 include하지 않으면, 다음을 수행한다.
    1. « Time Zone Identifier Record { [[Identifier]]: "UTC", [[PrimaryIdentifier]]: "UTC" } »를 반환한다.
  2. identifierslexicographic code unit order에 따라 sorted된 unique available named time zone identifier의 List로 둔다.
  3. result를 새 empty List로 둔다.
  4. identifiers의 각 element identifier에 대해, 다음을 수행한다.
    1. primaryidentifier로 둔다.
    2. identifier가 이 implementation에서 non-primary time zone identifier이고 identifier"UTC"가 아니면, 다음을 수행한다.
      1. primaryidentifier와 associated된 primary time zone identifier로 설정한다.
      2. NOTE: implementation은 primary time zone identifier를 obtain하기 위해 identifier를 iteratively resolve해야 할 수 있다.
    3. recordTime Zone Identifier Record { [[Identifier]]: identifier, [[PrimaryIdentifier]]: primary }로 둔다.
    4. recordresult에 append한다.
  5. Assert: resultrecord.[[Identifier]]"UTC"이고 record.[[PrimaryIdentifier]]"UTC"Time Zone Identifier Record record를 contain한다.
  6. result를 반환한다.

21.4.1.24 SystemTimeZoneIdentifier ( )

The implementation-defined abstract operation SystemTimeZoneIdentifier takes no arguments and returns a String. host environment의 current time zone을 represent하는 String을 반환합니다. 이는 IsTimeZoneOffsetStringtrue를 반환하는 UTC offset을 represent하는 String이거나 primary time zone identifier입니다. It performs the following steps when called:

  1. implementation이 UTC time zone만 support하면, "UTC"를 반환한다.
  2. systemTimeZoneStringhost environment의 current time zone을 represent하는 String으로 둔다. 이는 primary time zone identifier 또는 offset time zone identifier이다.
  3. systemTimeZoneString을 반환한다.
Note

Date object의 method에서 implementation이 commonly provide하는 functionality level을 ensure하기 위해, such thing이 exist한다면 SystemTimeZoneIdentifier가 host environment의 time zone setting에 corresponding하는 IANA time zone name을 return하는 것이 recommended됩니다. GetNamedTimeZoneEpochNanosecondsGetNamedTimeZoneOffsetNanoseconds는 such rules가 exist한다면 해당 time zone의 standard time 및 daylight saving time에 대한 local political rules를 reflect해야 합니다.

예를 들어 host environment가 user가 time zone으로 US Eastern Time을 chosen한 system의 browser라면, SystemTimeZoneIdentifier는 "America/New_York"를 반환합니다.

21.4.1.25 LocalTime ( tv )

The abstract operation LocalTime takes argument tv (a finite time value) and returns an integral Number. tv를 UTC에서 local time으로 convert합니다. tv에서 effect 중인 standard time 및 daylight saving time에 대한 local political rules를 사용하여 이 section에 specified된 way로 result를 determine해야 합니다. It performs the following steps when called:

  1. systemTimeZoneIdentifierSystemTimeZoneIdentifier()로 둔다.
  2. IsTimeZoneOffsetString(systemTimeZoneIdentifier)이 true이면, 다음을 수행한다.
    1. offsetNsParseTimeZoneOffsetString(systemTimeZoneIdentifier)로 둔다.
  3. 그렇지 않으면,
    1. offsetNsGetNamedTimeZoneOffsetNanoseconds(systemTimeZoneIdentifier, ((tv) × 106))로 둔다.
  4. offsetMstruncate(offsetNs / 106)로 둔다.
  5. tv + 𝔽(offsetMs)를 반환한다.
Note 1

local time tv에 대한 political rules가 implementation 안에서 available하지 않으면, SystemTimeZoneIdentifier"UTC"를 반환하고 GetNamedTimeZoneOffsetNanoseconds가 0을 반환하므로 result는 tv입니다.

Note 2

time zone aware implementation에 대해 required되고(all others에도 recommended됨), IANA Time Zone Database https://www.iana.org/time-zones/의 time zone information을 사용해야 합니다.

Note 3

negative time zone transition에서 repeated time이 있을 때(예: daylight saving time이 끝나거나 time zone adjustment가 decreased되는 경우) two different input time value tvUTC가 same local time tlocal로 converted됩니다.

LocalTime(UTC(tvlocal))는 necessarily always tvlocal와 equal하지 않습니다. Correspondingly, UTC(LocalTime(tvUTC))도 necessarily always tvUTC와 equal하지 않습니다.

21.4.1.26 UTC ( t )

The abstract operation UTC takes argument t (a Number) and returns a time value. t를 local time에서 UTC time value로 convert합니다. t에서 effect 중인 standard time 및 daylight saving time에 대한 local political rules를 사용하여 이 section에 specified된 way로 result를 determine해야 합니다. It performs the following steps when called:

  1. tfinite가 아니면, NaN을 반환한다.
  2. systemTimeZoneIdentifierSystemTimeZoneIdentifier()로 둔다.
  3. IsTimeZoneOffsetString(systemTimeZoneIdentifier)이 true이면, 다음을 수행한다.
    1. offsetNsParseTimeZoneOffsetString(systemTimeZoneIdentifier)로 둔다.
  4. 그렇지 않으면,
    1. possibleInstantsGetNamedTimeZoneEpochNanoseconds(systemTimeZoneIdentifier, (YearFromTime(t)), (MonthFromTime(t)) + 1, (DateFromTime(t)), (HourFromTime(t)), (MinFromTime(t)), (SecFromTime(t)), (msFromTime(t)), 0, 0)로 둔다.
    2. NOTE: 다음 steps는 t가 negative time zone transition에서 multiple times repeating되는 local time(예: daylight saving time이 끝나거나 time zone rule change 때문에 time zone offset이 decreased되는 경우) 또는 positive time zone transition에서 skipped local time(예: daylight saving time이 시작되거나 time zone rule change 때문에 time zone offset이 increased되는 경우)을 represent할 때, t가 transition before의 time zone offset을 사용하여 interpreted되도록 ensure한다.
    3. possibleInstants가 empty가 아니면, 다음을 수행한다.
      1. disambiguatedInstantpossibleInstants[0]으로 둔다.
    4. 그렇지 않으면,
      1. NOTE: t는 positive time zone transition에서 skipped된 local time을 represent한다(예: daylight saving time starting 또는 time zone rule change가 UTC offset을 increasing하기 때문).
      2. possibleInstantsBeforeGetNamedTimeZoneEpochNanoseconds(systemTimeZoneIdentifier, (YearFromTime(tBefore)), (MonthFromTime(tBefore)) + 1, (DateFromTime(tBefore)), (HourFromTime(tBefore)), (MinFromTime(tBefore)), (SecFromTime(tBefore)), (msFromTime(tBefore)), 0, 0)로 둔다. 여기서 tBeforepossibleInstantsBefore가 empty가 아닌 largest integral Number < t이다(즉 tBefore는 transition before의 last local time을 represent한다).
      3. disambiguatedInstantpossibleInstantsBefore의 last element로 둔다.
    5. offsetNsGetNamedTimeZoneOffsetNanoseconds(systemTimeZoneIdentifier, disambiguatedInstant)로 둔다.
  5. offsetMstruncate(offsetNs / 106)로 둔다.
  6. t - 𝔽(offsetMs)를 반환한다.

input t는 nominally time value이지만 any Number value일 수 있습니다. algorithm은 ttime value range로 limit해서는 안 됩니다. 그러면 local UTC offset에 관계없이 time value range의 boundary와 corresponding하는 input이 support될 수 있습니다. 예를 들어 maximum time value는 8.64 × 1015이며, 이는 "+275760-09-13T00:00:00Z"에 corresponding합니다. local time zone offset이 해당 instant에서 UTC보다 1 hour ahead인 environment에서는, 더 큰 input인 8.64 × 1015 + 3.6 × 106로 represented되며, 이는 "+275760-09-13T01:00:00+01:00"에 corresponding합니다.

local time t에 대한 political rules가 implementation 안에서 available하지 않으면, SystemTimeZoneIdentifier"UTC"를 반환하고 GetNamedTimeZoneOffsetNanoseconds가 0을 반환하므로 result는 t입니다.

Note 1

time zone aware implementation에 대해 required되고(all others에도 recommended됨), IANA Time Zone Database https://www.iana.org/time-zones/의 time zone information을 사용해야 합니다.

America/New_York에서 2017년 11월 5일 1:30 AM은 twice repeated됩니다(fall backward). 하지만 이는 1:30 AM UTC-05가 아니라 1:30 AM UTC-04로 interpreted되어야 합니다. UTC(TimeClip(MakeDate(MakeDay(2017, 10, 5), MakeTime(1, 30, 0, 0))))에서 offsetMs의 value는 -4 × msPerHour입니다.

America/New_York에서 2017년 3월 12일 2:30 AM은 exist하지 않지만, 2:30 AM UTC-05(3:30 AM UTC-04와 equivalent)로 interpreted되어야 합니다. UTC(TimeClip(MakeDate(MakeDay(2017, 2, 12), MakeTime(2, 30, 0, 0))))에서 offsetMs의 value는 -5 × msPerHour입니다.

Note 2

UTC(LocalTime(tUTC))는 necessarily always tUTC와 equal하지 않습니다. Correspondingly, LocalTime(UTC(tlocal))도 necessarily always tlocal와 equal하지 않습니다.

21.4.1.27 MakeTime ( hour, min, sec, ms )

The abstract operation MakeTime takes arguments hour (a Number), min (a Number), sec (a Number), and ms (a Number) and returns a Number. milliseconds 수를 calculate합니다. It performs the following steps when called:

  1. hourfinite가 아니거나, minfinite가 아니거나, secfinite가 아니거나, msfinite가 아니면, NaN을 반환한다.
  2. h𝔽(! ToIntegerOrInfinity(hour))로 둔다.
  3. m𝔽(! ToIntegerOrInfinity(min))로 둔다.
  4. s𝔽(! ToIntegerOrInfinity(sec))로 둔다.
  5. milli𝔽(! ToIntegerOrInfinity(ms))로 둔다.
  6. ((h × msPerHour + m × msPerMinute) + s × msPerSecond) + milli를 반환한다.
Note

MakeTime 안의 arithmetic은 floating-point arithmetic이며 associative하지 않으므로, operation은 correct order로 performed되어야 합니다.

21.4.1.28 MakeDay ( year, month, date )

The abstract operation MakeDay takes arguments year (a Number), month (a Number), and date (a Number) and returns a finite Number or NaN. days 수를 calculate합니다. It performs the following steps when called:

  1. yearfinite가 아니거나, monthfinite가 아니거나, datefinite가 아니면, NaN을 반환한다.
  2. y𝔽(! ToIntegerOrInfinity(year))로 둔다.
  3. m𝔽(! ToIntegerOrInfinity(month))로 둔다.
  4. dt𝔽(! ToIntegerOrInfinity(date))로 둔다.
  5. ymy + 𝔽(floor((m) / 12))로 둔다.
  6. ymfinite가 아니면, NaN을 반환한다.
  7. mn𝔽((m) modulo 12)로 둔다.
  8. YearFromTime(tv)가 ym이고, MonthFromTime(tv)가 mn이며, DateFromTime(tv)가 1𝔽finite time value tv를 find한다; 하지만 이것이 possible하지 않으면(어떤 argument가 out of range이므로), NaN을 반환한다.
  9. Day(tv) + dt - 1𝔽를 반환한다.

21.4.1.29 MakeDate ( day, time )

The abstract operation MakeDate takes arguments day (a Number) and time (a Number) and returns a finite Number or NaN. milliseconds 수를 calculate합니다. It performs the following steps when called:

  1. dayfinite가 아니거나 timefinite가 아니면, NaN을 반환한다.
  2. tvday × msPerDay + time으로 둔다.
  3. tvfinite가 아니면, NaN을 반환한다.
  4. tv를 반환한다.

21.4.1.30 MakeFullYear ( year )

The abstract operation MakeFullYear takes argument year (a Number) and returns an integral Number or NaN. yearinteger part와 associated된 full year를 반환하며, 0부터 99까지의 inclusive interval 안의 any value를 1900 start 이후 years count로 interpret합니다. proleptic Gregorian calendar와 alignment하기 위해, “full year”는 year 0(1 B.C.) start 이후 complete years의 signed count로 defined됩니다. It performs the following steps when called:

  1. yearNaN, +∞𝔽, 또는 -∞𝔽 중 하나이면, NaN을 반환한다.
  2. truncated를 ! ToIntegerOrInfinity(year)로 둔다.
  3. truncated가 0부터 99까지의 inclusive interval 안에 있으면, 1900𝔽 + 𝔽(truncated)를 반환한다.
  4. 𝔽(truncated)를 반환한다.

21.4.1.31 TimeClip ( time )

The abstract operation TimeClip takes argument time (a Number) and returns a time value. milliseconds 수를 calculate합니다. It performs the following steps when called:

  1. timefinite가 아니면, NaN을 반환한다.
  2. abs((time)) > 8.64 × 1015이면, NaN을 반환한다.
  3. 𝔽(! ToIntegerOrInfinity(time))를 반환한다.

21.4.1.32 Date Time String Format

ECMAScript는 ISO 8601 calendar date extended format의 simplification을 기반으로 date-times를 위한 string interchange format을 define합니다. format은 다음과 같습니다: YYYY-MM-DDTHH:mm:ss.sssZ

elements는 다음과 같습니다:

YYYY proleptic Gregorian calendar에서 0000부터 9999까지의 four decimal digits로 된 year이거나, "+" 또는 "-" 뒤에 six decimal digits가 followed되는 expanded year입니다.
- "-" (hyphen)가 string 안에 literally twice appear합니다.
MM 01 (January)부터 12 (December)까지의 two decimal digits로 된 year의 month입니다.
DD 01부터 31까지의 two decimal digits로 된 month의 day입니다.
T time element의 beginning을 indicate하기 위해 "T"가 string 안에 literally appear합니다.
HH midnight 이후 passed한 complete hours 수이며, 00부터 24까지의 two decimal digits입니다.
: ":" (colon)가 string 안에 literally twice appear합니다.
mm hour의 start 이후 complete minutes 수이며, 00부터 59까지의 two decimal digits입니다.
ss minute의 start 이후 complete seconds 수이며, 00부터 59까지의 two decimal digits입니다.
. "." (dot)가 string 안에 literally appear합니다.
sss second의 start 이후 complete milliseconds 수이며, three decimal digits입니다.
Z UTC offset representation이며, "Z" (offset 없는 UTC)로 specified되거나, local time이 UTC보다 ahead 또는 behind임을 indicate하기 위해 "+" 또는 "-" 뒤에 time expression HH:mm가 followed되는 형식(time zone offset string format의 subset)입니다.

이 format은 date-only form을 include합니다:

YYYY
YYYY-MM
YYYY-MM-DD
        

또한 above date-only form 중 하나 바로 뒤에 following time form 중 하나가 followed되고 optional UTC offset representation이 appended되는 “date-time” form도 include합니다:

THH:mm
THH:mm:ss
THH:mm:ss.sss
        

out-of-bounds 또는 nonconforming element를 contain하는 string은 이 format의 valid instance가 아닙니다.

Note 1

every day는 midnight로 start하고 end하므로, two notations 00:0024:00는 one date와 associated될 수 있는 two midnights를 distinguish하기 위해 available합니다. 이는 following two notations가 exactly same point in time을 refer함을 의미합니다: 1995-02-04T24:001995-02-05T00:00. latter form을 “calendar day의 end”로 해석하는 것은 ISO 8601과 consistent합니다. 그 specification이 이를 time interval을 describing하는 데 reserve하고 single point in time의 representation 안에서는 permit하지 않더라도 그렇습니다.

Note 2

CET, EST 등과 같은 civil time zone의 abbreviation을 specify하는 international standard는 존재하지 않으며, sometimes same abbreviation이 even two very different time zones에 사용됩니다. 이러한 이유로 ISO 8601과 이 format 모두 time zone offset의 numeric representation을 specify합니다.

21.4.1.32.1 Expanded Years

1970년 1월 1일을 기준으로 forward 또는 backward approximately 273,790 years의 full time value range를 cover하려면(21.4.1.1), 0 before 또는 9999 after의 years를 represent해야 합니다. ISO 8601은 year representation의 expansion을 permit하지만, information interchange의 partners 간 mutual agreement에 의해서만 permit합니다. simplified ECMAScript format에서 such expanded year representation은 6 digits를 가져야 하며 항상 + 또는 - sign이 prefixed됩니다. year 0은 positive로 considered되며 + sign으로 prefixed되어야 합니다. year 0을 -000000으로 represent하는 것은 invalid입니다. expanded years를 가진 Date Time String Format과 match하는 String이 time value range outside의 instant를 represent하면, Date.parse에 의해 unrecognizable로 treated되고 implementation-specific behaviour 또는 heuristics로 fallback하지 않고 그 function이 NaN을 return하게 합니다.

Note

expanded years를 가진 date-time values의 examples:

-271821-04-20T00:00:00Z 271822 B.C.
-000001-01-01T00:00:00Z 2 B.C.
+000000-01-01T00:00:00Z 1 B.C.
+000001-01-01T00:00:00Z 1 A.D.
+001970-01-01T00:00:00Z 1970 A.D.
+002009-12-15T00:00:00Z 2009 A.D.
+275760-09-13T00:00:00Z 275760 A.D.

21.4.1.33 Time Zone Offset String Format

ECMAScript는 ISO 8601에서 derived된 UTC offsets를 위한 string interchange format을 define합니다. format은 following grammar로 described됩니다.

Syntax

UTCOffset ::: ASCIISign Hour ASCIISign Hour HourSubcomponents[+Extended] ASCIISign Hour HourSubcomponents[~Extended] ASCIISign ::: one of + - Hour ::: 0 DecimalDigit 1 DecimalDigit 20 21 22 23 HourSubcomponents[Extended] ::: TimeSeparator[?Extended] MinuteSecond TimeSeparator[?Extended] MinuteSecond TimeSeparator[?Extended] MinuteSecond TemporalDecimalFractionopt TimeSeparator[Extended] ::: [+Extended] : [~Extended] [empty] MinuteSecond ::: 0 DecimalDigit 1 DecimalDigit 2 DecimalDigit 3 DecimalDigit 4 DecimalDigit 5 DecimalDigit TemporalDecimalFraction ::: TemporalDecimalSeparator DecimalDigit TemporalDecimalSeparator DecimalDigit DecimalDigit TemporalDecimalSeparator DecimalDigit DecimalDigit DecimalDigit TemporalDecimalSeparator DecimalDigit DecimalDigit DecimalDigit DecimalDigit TemporalDecimalSeparator DecimalDigit DecimalDigit DecimalDigit DecimalDigit DecimalDigit TemporalDecimalSeparator DecimalDigit DecimalDigit DecimalDigit DecimalDigit DecimalDigit DecimalDigit TemporalDecimalSeparator DecimalDigit DecimalDigit DecimalDigit DecimalDigit DecimalDigit DecimalDigit DecimalDigit TemporalDecimalSeparator DecimalDigit DecimalDigit DecimalDigit DecimalDigit DecimalDigit DecimalDigit DecimalDigit DecimalDigit TemporalDecimalSeparator DecimalDigit DecimalDigit DecimalDigit DecimalDigit DecimalDigit DecimalDigit DecimalDigit DecimalDigit DecimalDigit TemporalDecimalSeparator ::: one of . ,

21.4.1.33.1 IsTimeZoneOffsetString ( offsetString )

The abstract operation IsTimeZoneOffsetString takes argument offsetString (a String) and returns a Boolean. return value는 offsetStringUTCOffset에 의해 given된 grammar에 conform하는지 여부를 indicate합니다. It performs the following steps when called:

  1. parseResultParseText(offsetString, UTCOffset)로 둔다.
  2. parseResult가 error의 List이면, false를 반환한다.
  3. true를 반환한다.

21.4.1.33.2 ParseTimeZoneOffsetString ( offsetString )

The abstract operation ParseTimeZoneOffsetString takes argument offsetString (a String) and returns an integer. return value는 String offsetString에 corresponding하는 UTC offset이며, nanoseconds 수입니다. It performs the following steps when called:

  1. parseResultParseText(offsetString, UTCOffset)로 둔다.
  2. Assert: parseResult는 error의 List가 아니다.
  3. Assert: parseResultASCIISign Parse Node를 contain한다.
  4. parsedSignparseResult 안에 contained된 ASCIISign Parse Node가 matched한 source text로 둔다.
  5. parsedSign이 single code point U+002D (HYPHEN-MINUS)이면, 다음을 수행한다.
    1. sign을 -1로 둔다.
  6. 그렇지 않으면,
    1. sign을 1로 둔다.
  7. NOTE: 아래 StringToNumber의 application은 precision을 lose하지 않는다. parsed value 각각은 sufficiently short string of decimal digits임이 guaranteed되기 때문이다.
  8. Assert: parseResultHour Parse Node를 contain한다.
  9. parsedHoursparseResult 안에 contained된 Hour Parse Node가 matched한 source text로 둔다.
  10. hours(StringToNumber(CodePointsToString(parsedHours)))로 둔다.
  11. parseResultMinuteSecond Parse Node를 contain하지 않으면, 다음을 수행한다.
    1. minutes를 0으로 둔다.
  12. 그렇지 않으면,
    1. parsedMinutesparseResult 안에 contained된 first MinuteSecond Parse Node가 matched한 source text로 둔다.
    2. minutes(StringToNumber(CodePointsToString(parsedMinutes)))로 둔다.
  13. parseResult가 two MinuteSecond Parse Nodes를 contain하지 않으면, 다음을 수행한다.
    1. seconds를 0으로 둔다.
  14. 그렇지 않으면,
    1. parsedSecondsparseResult 안에 contained된 second MinuteSecond Parse Node가 matched한 source text로 둔다.
    2. seconds(StringToNumber(CodePointsToString(parsedSeconds)))로 둔다.
  15. parseResultTemporalDecimalFraction Parse Node를 contain하지 않으면, 다음을 수행한다.
    1. nanoseconds를 0으로 둔다.
  16. 그렇지 않으면,
    1. parsedFractionparseResult 안에 contained된 TemporalDecimalFraction Parse Node가 matched한 source text로 둔다.
    2. fractionCodePointsToString(parsedFraction)과 "000000000"string-concatenation으로 둔다.
    3. nanosecondsStringfraction의 1부터 10까지의 substring으로 둔다.
    4. nanoseconds(StringToNumber(nanosecondsString))로 둔다.
  17. sign × (((hours × 60 + minutes) × 60 + seconds) × 109 + nanoseconds)를 반환한다.

21.4.2 The Date Constructor

Date constructor는:

  • %Date%입니다.
  • global object"Date" property의 initial value입니다.
  • constructor로 called될 때 new Date를 create하고 initialize합니다.
  • constructor가 아니라 function으로 called될 때 current time(UTC)을 represent하는 String을 반환합니다.
  • argument의 number 및 type에 따라 behaviour가 differ하는 function입니다.
  • class definition의 extends clause의 value로 사용될 수 있습니다. specified Date behaviour를 inherit하려는 subclass constructor[[DateValue]] internal slot을 가진 subclass instance를 create하고 initialize하기 위해 Date constructor에 대한 super call을 include해야 합니다.

21.4.2.1 Date ( ...values )

이 function은 called될 때 following steps를 수행합니다:

  1. NewTarget이 undefined이면, 다음을 수행한다.
    1. now를 current time을 identifying하는 time value (UTC)로 둔다.
    2. ToDateString(now)를 반환한다.
  2. numberOfArgsvalues 안의 elements 수로 둔다.
  3. numberOfArgs = 0이면, 다음을 수행한다.
    1. dv를 current time을 identifying하는 time value (UTC)로 둔다.
  4. 그렇지 않고 numberOfArgs = 1이면, 다음을 수행한다.
    1. valuevalues[0]으로 둔다.
    2. value가 Object이고 value[[DateValue]] internal slot을 가지면, 다음을 수행한다.
      1. tvvalue.[[DateValue]]로 둔다.
    3. 그렇지 않으면,
      1. v를 ? ToPrimitive(value)로 둔다.
      2. v가 String이면, 다음을 수행한다.
        1. Assert: next step은 v가 String이므로 abrupt completion을 never return한다.
        2. tvparse method(21.4.3.2)에서와 exactly same manner로 v를 date로 parsing한 result로 둔다.
      3. 그렇지 않으면,
        1. tv를 ? ToNumber(v)로 둔다.
    4. dvTimeClip(tv)로 둔다.
  5. 그렇지 않으면,
    1. Assert: numberOfArgs ≥ 2이다.
    2. y를 ? ToNumber(values[0])로 둔다.
    3. m을 ? ToNumber(values[1])로 둔다.
    4. numberOfArgs > 2이면 dt를 ? ToNumber(values[2])로 둔다; 그렇지 않으면 dt1𝔽로 둔다.
    5. numberOfArgs > 3이면 h를 ? ToNumber(values[3])로 둔다; 그렇지 않으면 h+0𝔽로 둔다.
    6. numberOfArgs > 4이면 min을 ? ToNumber(values[4])로 둔다; 그렇지 않으면 min+0𝔽로 둔다.
    7. numberOfArgs > 5이면 s를 ? ToNumber(values[5])로 둔다; 그렇지 않으면 s+0𝔽로 둔다.
    8. numberOfArgs > 6이면 milli를 ? ToNumber(values[6])로 둔다; 그렇지 않으면 milli+0𝔽로 둔다.
    9. yrMakeFullYear(y)로 둔다.
    10. finalDateMakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli))로 둔다.
    11. dvTimeClip(UTC(finalDate))로 둔다.
  6. obj를 ? OrdinaryCreateFromConstructor(NewTarget, "%Date.prototype%", « [[DateValue]] »)로 둔다.
  7. obj.[[DateValue]]dv로 설정한다.
  8. obj를 반환한다.

21.4.3 Properties of the Date Constructor

Date constructor는:

  • value가 %Function.prototype%[[Prototype]] internal slot을 가집니다.
  • value가 7𝔽"length" property를 가집니다.
  • 다음 property를 가집니다:

21.4.3.1 Date.now ( )

이 function은 call이 occur한 UTC date 및 time을 designating하는 time value를 반환합니다.

21.4.3.2 Date.parse ( string )

이 function은 argument에 ToString operator를 apply합니다. ToStringabrupt completion을 result하면 Completion Record가 immediately returned됩니다. Otherwise, 이 function은 resulting String을 date 및 time으로 interpret합니다; date 및 time에 corresponding하는 UTC time value인 Number를 반환합니다. String은 contents에 따라 local time, UTC time, 또는 어떤 other time zone의 time으로 interpreted될 수 있습니다. function은 first로 expanded years를 포함하여 Date Time String Format(21.4.1.32)에 described된 format에 따라 String을 parse하려고 attempt합니다. String이 that format에 conform하지 않으면 function은 any implementation-specific heuristics 또는 implementation-specific date format으로 fallback할 수 있습니다. unrecognizable하거나 out-of-bounds format element value를 contain하는 String은 이 function이 NaN을 return하게 해야 합니다.

String이 Date Time String Format에 conform하면, absent format element 대신 substitute value가 take됩니다. MM 또는 DD elements가 absent이면, "01"이 사용됩니다. HH, mm, 또는 ss elements가 absent이면, "00"이 사용됩니다. sss element가 absent이면, "000"이 사용됩니다. UTC offset representation이 absent이면, date-only form은 UTC time으로 interpreted되고 date-time form은 local time으로 interpreted됩니다.

x가 ECMAScript의 particular implementation 안에서 milliseconds amount가 zero인 any Date이면, all referenced properties가 their initial values를 가진다면, following expressions는 that implementation에서 same numeric value를 produce해야 합니다:

x.valueOf()
Date.parse(x.toString())
Date.parse(x.toUTCString())
Date.parse(x.toISOString())

However, expression

Date.parse(x.toLocaleString())

은 preceding three expressions와 same Number value를 produce할 필요가 없으며, general하게 이 function에 Date Time String Format(21.4.1.32)에 conform하지 않고 that implementation에서 toString 또는 toUTCString method에 의해 produced될 수 없는 any String value가 given될 때 produced되는 value는 implementation-defined입니다.

21.4.3.3 Date.prototype

Date.prototype의 initial value는 Date prototype object입니다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: false }를 가집니다.

21.4.3.4 Date.UTC ( year [ , month [ , date [ , hours [ , minutes [ , seconds [ , ms ] ] ] ] ] ] )

이 function은 called될 때 following steps를 수행합니다:

  1. y를 ? ToNumber(year)로 둔다.
  2. month가 present하면, m을 ? ToNumber(month)로 둔다; 그렇지 않으면 m+0𝔽로 둔다.
  3. date가 present하면, dt를 ? ToNumber(date)로 둔다; 그렇지 않으면 dt1𝔽로 둔다.
  4. hours가 present하면, h를 ? ToNumber(hours)로 둔다; 그렇지 않으면 h+0𝔽로 둔다.
  5. minutes가 present하면, min을 ? ToNumber(minutes)로 둔다; 그렇지 않으면 min+0𝔽로 둔다.
  6. seconds가 present하면, s를 ? ToNumber(seconds)로 둔다; 그렇지 않으면 s+0𝔽로 둔다.
  7. ms가 present하면, milli를 ? ToNumber(ms)로 둔다; 그렇지 않으면 milli+0𝔽로 둔다.
  8. yrMakeFullYear(y)로 둔다.
  9. TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli)))를 반환한다.

이 function의 "length" property는 7𝔽입니다.

Note

이 function은 Date constructor와 two ways에서 differ합니다: Date를 creating하는 대신 time value를 Number로 반환하고, arguments를 local time이 아니라 UTC로 interpret합니다.

21.4.4 Properties of the Date Prototype Object

Date prototype object는:

  • %Date.prototype%입니다.
  • itself가 ordinary object입니다.
  • Date instance가 아니며 [[DateValue]] internal slot을 가지지 않습니다.
  • value가 %Object.prototype%[[Prototype]] internal slot을 가집니다.

explicitly 달리 defined되지 않는 한, 아래에 defined된 Date prototype object의 methods는 generic하지 않으며, 이들에게 passed되는 this value는 time value로 initialized된 [[DateValue]] internal slot을 가진 object여야 합니다.

21.4.4.1 Date.prototype.constructor

Date.prototype.constructor의 initial value는 %Date%입니다.

21.4.4.2 Date.prototype.getDate ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. DateFromTime(LocalTime(tv))를 반환한다.

21.4.4.3 Date.prototype.getDay ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. WeekDay(LocalTime(tv))를 반환한다.

21.4.4.4 Date.prototype.getFullYear ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. YearFromTime(LocalTime(tv))를 반환한다.

21.4.4.5 Date.prototype.getHours ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. HourFromTime(LocalTime(tv))를 반환한다.

21.4.4.6 Date.prototype.getMilliseconds ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. msFromTime(LocalTime(tv))를 반환한다.

21.4.4.7 Date.prototype.getMinutes ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. MinFromTime(LocalTime(tv))를 반환한다.

21.4.4.8 Date.prototype.getMonth ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. MonthFromTime(LocalTime(tv))를 반환한다.

21.4.4.9 Date.prototype.getSeconds ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. SecFromTime(LocalTime(tv))를 반환한다.

21.4.4.10 Date.prototype.getTime ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. dateObj.[[DateValue]]를 반환한다.

21.4.4.11 Date.prototype.getTimezoneOffset ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. (tv - LocalTime(tv)) / msPerMinute를 반환한다.

21.4.4.12 Date.prototype.getUTCDate ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. DateFromTime(tv)를 반환한다.

21.4.4.13 Date.prototype.getUTCDay ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. WeekDay(tv)를 반환한다.

21.4.4.14 Date.prototype.getUTCFullYear ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. YearFromTime(tv)를 반환한다.

21.4.4.15 Date.prototype.getUTCHours ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. HourFromTime(tv)를 반환한다.

21.4.4.16 Date.prototype.getUTCMilliseconds ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. msFromTime(tv)를 반환한다.

21.4.4.17 Date.prototype.getUTCMinutes ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. MinFromTime(tv)를 반환한다.

21.4.4.18 Date.prototype.getUTCMonth ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. MonthFromTime(tv)를 반환한다.

21.4.4.19 Date.prototype.getUTCSeconds ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, NaN을 반환한다.
  5. SecFromTime(tv)를 반환한다.

21.4.4.20 Date.prototype.setDate ( date )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. dt를 ? ToNumber(date)로 둔다.
  5. tvNaN이면, NaN을 반환한다.
  6. tvLocalTime(tv)로 설정한다.
  7. newDateMakeDate(MakeDay(YearFromTime(tv), MonthFromTime(tv), dt), TimeWithinDay(tv))로 둔다.
  8. uTimeClip(UTC(newDate))로 둔다.
  9. dateObj.[[DateValue]]u로 설정한다.
  10. u를 반환한다.

21.4.4.21 Date.prototype.setFullYear ( year [ , month [ , date ] ] )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. y를 ? ToNumber(year)로 둔다.
  5. tvNaN이면 tv+0𝔽로 설정한다; 그렇지 않으면 tvLocalTime(tv)로 설정한다.
  6. month가 present하면, m을 ? ToNumber(month)로 둔다; 그렇지 않으면 mMonthFromTime(tv)로 둔다.
  7. date가 present하면, dt를 ? ToNumber(date)로 둔다; 그렇지 않으면 dtDateFromTime(tv)로 둔다.
  8. newDateMakeDate(MakeDay(y, m, dt), TimeWithinDay(tv))로 둔다.
  9. uTimeClip(UTC(newDate))로 둔다.
  10. dateObj.[[DateValue]]u로 설정한다.
  11. u를 반환한다.

이 method의 "length" property는 3𝔽입니다.

Note

month가 present하지 않으면, 이 method는 month가 value getMonth()로 present한 것처럼 behave합니다. date가 present하지 않으면, date가 value getDate()로 present한 것처럼 behave합니다.

21.4.4.22 Date.prototype.setHours ( hour [ , min [ , sec [ , ms ] ] ] )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. h를 ? ToNumber(hour)로 둔다.
  5. min이 present하면, m을 ? ToNumber(min)으로 둔다.
  6. sec가 present하면, s를 ? ToNumber(sec)로 둔다.
  7. ms가 present하면, milli를 ? ToNumber(ms)로 둔다.
  8. tvNaN이면, NaN을 반환한다.
  9. tvLocalTime(tv)로 설정한다.
  10. min이 present하지 않으면, mMinFromTime(tv)로 둔다.
  11. sec가 present하지 않으면, sSecFromTime(tv)로 둔다.
  12. ms가 present하지 않으면, millimsFromTime(tv)로 둔다.
  13. dateMakeDate(Day(tv), MakeTime(h, m, s, milli))로 둔다.
  14. uTimeClip(UTC(date))로 둔다.
  15. dateObj.[[DateValue]]u로 설정한다.
  16. u를 반환한다.

이 method의 "length" property는 4𝔽입니다.

Note

min이 present하지 않으면, 이 method는 min이 value getMinutes()로 present한 것처럼 behave합니다. sec가 present하지 않으면, sec가 value getSeconds()로 present한 것처럼 behave합니다. ms가 present하지 않으면, ms가 value getMilliseconds()로 present한 것처럼 behave합니다.

21.4.4.23 Date.prototype.setMilliseconds ( ms )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. ms를 ? ToNumber(ms)로 설정한다.
  5. tvNaN이면, NaN을 반환한다.
  6. tvLocalTime(tv)로 설정한다.
  7. timeMakeTime(HourFromTime(tv), MinFromTime(tv), SecFromTime(tv), ms)로 둔다.
  8. uTimeClip(UTC(MakeDate(Day(tv), time)))로 둔다.
  9. dateObj.[[DateValue]]u로 설정한다.
  10. u를 반환한다.

21.4.4.24 Date.prototype.setMinutes ( min [ , sec [ , ms ] ] )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. m을 ? ToNumber(min)으로 둔다.
  5. sec가 present하면, s를 ? ToNumber(sec)로 둔다.
  6. ms가 present하면, milli를 ? ToNumber(ms)로 둔다.
  7. tvNaN이면, NaN을 반환한다.
  8. tvLocalTime(tv)로 설정한다.
  9. sec가 present하지 않으면, sSecFromTime(tv)로 둔다.
  10. ms가 present하지 않으면, millimsFromTime(tv)로 둔다.
  11. dateMakeDate(Day(tv), MakeTime(HourFromTime(tv), m, s, milli))로 둔다.
  12. uTimeClip(UTC(date))로 둔다.
  13. dateObj.[[DateValue]]u로 설정한다.
  14. u를 반환한다.

이 method의 "length" property는 3𝔽입니다.

Note

sec가 present하지 않으면, 이 method는 sec가 value getSeconds()로 present한 것처럼 behave합니다. ms가 present하지 않으면, 이는 ms가 value getMilliseconds()로 present한 것처럼 behave합니다.

21.4.4.25 Date.prototype.setMonth ( month [ , date ] )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. m을 ? ToNumber(month)로 둔다.
  5. date가 present하면, dt를 ? ToNumber(date)로 둔다.
  6. tvNaN이면, NaN을 반환한다.
  7. tvLocalTime(tv)로 설정한다.
  8. date가 present하지 않으면, dtDateFromTime(tv)로 둔다.
  9. newDateMakeDate(MakeDay(YearFromTime(tv), m, dt), TimeWithinDay(tv))로 둔다.
  10. uTimeClip(UTC(newDate))로 둔다.
  11. dateObj.[[DateValue]]u로 설정한다.
  12. u를 반환한다.

이 method의 "length" property는 2𝔽입니다.

Note

date가 present하지 않으면, 이 method는 date가 value getDate()로 present한 것처럼 behave합니다.

21.4.4.26 Date.prototype.setSeconds ( sec [ , ms ] )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. s를 ? ToNumber(sec)로 둔다.
  5. ms가 present하면, milli를 ? ToNumber(ms)로 둔다.
  6. tvNaN이면, NaN을 반환한다.
  7. tvLocalTime(tv)로 설정한다.
  8. ms가 present하지 않으면, millimsFromTime(tv)로 둔다.
  9. dateMakeDate(Day(tv), MakeTime(HourFromTime(tv), MinFromTime(tv), s, milli))로 둔다.
  10. uTimeClip(UTC(date))로 둔다.
  11. dateObj.[[DateValue]]u로 설정한다.
  12. u를 반환한다.

이 method의 "length" property는 2𝔽입니다.

Note

ms가 present하지 않으면, 이 method는 ms가 value getMilliseconds()로 present한 것처럼 behave합니다.

21.4.4.27 Date.prototype.setTime ( time )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. t를 ? ToNumber(time)로 둔다.
  4. vTimeClip(t)로 둔다.
  5. dateObj.[[DateValue]]v로 설정한다.
  6. v를 반환한다.

21.4.4.28 Date.prototype.setUTCDate ( date )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. dt를 ? ToNumber(date)로 둔다.
  5. tvNaN이면, NaN을 반환한다.
  6. newDateMakeDate(MakeDay(YearFromTime(tv), MonthFromTime(tv), dt), TimeWithinDay(tv))로 둔다.
  7. vTimeClip(newDate)로 둔다.
  8. dateObj.[[DateValue]]v로 설정한다.
  9. v를 반환한다.

21.4.4.29 Date.prototype.setUTCFullYear ( year [ , month [ , date ] ] )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, tv+0𝔽로 설정한다.
  5. y를 ? ToNumber(year)로 둔다.
  6. month가 present하면, m을 ? ToNumber(month)로 둔다; 그렇지 않으면 mMonthFromTime(tv)로 둔다.
  7. date가 present하면, dt를 ? ToNumber(date)로 둔다; 그렇지 않으면 dtDateFromTime(tv)로 둔다.
  8. newDateMakeDate(MakeDay(y, m, dt), TimeWithinDay(tv))로 둔다.
  9. vTimeClip(newDate)로 둔다.
  10. dateObj.[[DateValue]]v로 설정한다.
  11. v를 반환한다.

이 method의 "length" property는 3𝔽입니다.

Note

month가 present하지 않으면, 이 method는 month가 value getUTCMonth()로 present한 것처럼 behave합니다. date가 present하지 않으면, date가 value getUTCDate()로 present한 것처럼 behave합니다.

21.4.4.30 Date.prototype.setUTCHours ( hour [ , min [ , sec [ , ms ] ] ] )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. h를 ? ToNumber(hour)로 둔다.
  5. min이 present하면, m을 ? ToNumber(min)으로 둔다.
  6. sec가 present하면, s를 ? ToNumber(sec)로 둔다.
  7. ms가 present하면, milli를 ? ToNumber(ms)로 둔다.
  8. tvNaN이면, NaN을 반환한다.
  9. min이 present하지 않으면, mMinFromTime(tv)로 둔다.
  10. sec가 present하지 않으면, sSecFromTime(tv)로 둔다.
  11. ms가 present하지 않으면, millimsFromTime(tv)로 둔다.
  12. dateMakeDate(Day(tv), MakeTime(h, m, s, milli))로 둔다.
  13. vTimeClip(date)로 둔다.
  14. dateObj.[[DateValue]]v로 설정한다.
  15. v를 반환한다.

이 method의 "length" property는 4𝔽입니다.

Note

min이 present하지 않으면, 이 method는 min이 value getUTCMinutes()로 present한 것처럼 behave합니다. sec가 present하지 않으면, sec가 value getUTCSeconds()로 present한 것처럼 behave합니다. ms가 present하지 않으면, ms가 value getUTCMilliseconds()로 present한 것처럼 behave합니다.

21.4.4.31 Date.prototype.setUTCMilliseconds ( ms )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. ms를 ? ToNumber(ms)로 설정한다.
  5. tvNaN이면, NaN을 반환한다.
  6. timeMakeTime(HourFromTime(tv), MinFromTime(tv), SecFromTime(tv), ms)로 둔다.
  7. vTimeClip(MakeDate(Day(tv), time))로 둔다.
  8. dateObj.[[DateValue]]v로 설정한다.
  9. v를 반환한다.

21.4.4.32 Date.prototype.setUTCMinutes ( min [ , sec [ , ms ] ] )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. m을 ? ToNumber(min)으로 둔다.
  5. sec가 present하면, s를 ? ToNumber(sec)로 둔다.
  6. ms가 present하면, milli를 ? ToNumber(ms)로 둔다.
  7. tvNaN이면, NaN을 반환한다.
  8. sec가 present하지 않으면, sSecFromTime(tv)로 둔다.
  9. ms가 present하지 않으면, millimsFromTime(tv)로 둔다.
  10. dateMakeDate(Day(tv), MakeTime(HourFromTime(tv), m, s, milli))로 둔다.
  11. vTimeClip(date)로 둔다.
  12. dateObj.[[DateValue]]v로 설정한다.
  13. v를 반환한다.

이 method의 "length" property는 3𝔽입니다.

Note

sec가 present하지 않으면, 이 method는 sec가 value getUTCSeconds()로 present한 것처럼 behave합니다. ms가 present하지 않으면, 이는 msgetUTCMilliseconds()에 의해 returned되는 value로 present한 것처럼 behave합니다.

21.4.4.33 Date.prototype.setUTCMonth ( month [ , date ] )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. m을 ? ToNumber(month)로 둔다.
  5. date가 present하면, dt를 ? ToNumber(date)로 둔다.
  6. tvNaN이면, NaN을 반환한다.
  7. date가 present하지 않으면, dtDateFromTime(tv)로 둔다.
  8. newDateMakeDate(MakeDay(YearFromTime(tv), m, dt), TimeWithinDay(tv))로 둔다.
  9. vTimeClip(newDate)로 둔다.
  10. dateObj.[[DateValue]]v로 설정한다.
  11. v를 반환한다.

이 method의 "length" property는 2𝔽입니다.

Note

date가 present하지 않으면, 이 method는 date가 value getUTCDate()로 present한 것처럼 behave합니다.

21.4.4.34 Date.prototype.setUTCSeconds ( sec [ , ms ] )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. s를 ? ToNumber(sec)로 둔다.
  5. ms가 present하면, milli를 ? ToNumber(ms)로 둔다.
  6. tvNaN이면, NaN을 반환한다.
  7. ms가 present하지 않으면, millimsFromTime(tv)로 둔다.
  8. dateMakeDate(Day(tv), MakeTime(HourFromTime(tv), MinFromTime(tv), s, milli))로 둔다.
  9. vTimeClip(date)로 둔다.
  10. dateObj.[[DateValue]]v로 설정한다.
  11. v를 반환한다.

이 method의 "length" property는 2𝔽입니다.

Note

ms가 present하지 않으면, 이 method는 ms가 value getUTCMilliseconds()로 present한 것처럼 behave합니다.

21.4.4.35 Date.prototype.toDateString ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, "Invalid Date"를 반환한다.
  5. tLocalTime(tv)로 둔다.
  6. DateString(t)를 반환한다.

21.4.4.36 Date.prototype.toISOString ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, RangeError exception을 throw한다.
  5. Assert: tvintegral Number이다.
  6. tvDate Time String Format으로 represent될 수 없는 year와 corresponding하면, RangeError exception을 throw한다.
  7. all format elements 및 UTC offset representation "Z"를 포함하여 UTC time scale 상에서 Date Time String Format으로 된 tv의 String representation을 반환한다.

21.4.4.37 Date.prototype.toJSON ( key )

이 method는 JSON.stringify(25.5.4)가 사용할 Date의 String representation을 제공합니다.

called될 때 following steps를 수행합니다:

  1. obj를 ? ToObject(this value)로 둔다.
  2. tv를 ? ToPrimitive(obj, number)로 둔다.
  3. tv가 Number이고 tvfinite가 아니면, null을 반환한다.
  4. Invoke(obj, "toISOString")를 반환한다.
Note 1

argument는 ignored됩니다.

Note 2

이 method는 intentionally generic입니다; this value가 Date일 것을 require하지 않습니다. 따라서 method로 사용하기 위해 other kinds of objects에 transferred될 수 있습니다. However, any such object가 toISOString method를 가질 것을 require합니다.

21.4.4.38 Date.prototype.toLocaleDateString ( [ reserved1 [ , reserved2 ] ] )

ECMA-402 Internationalization API를 include하는 ECMAScript implementation은 ECMA-402 specification에 specified된 대로 이 method를 implement해야 합니다. ECMAScript implementation이 ECMA-402 API를 include하지 않으면 이 method의 following specification이 사용됩니다:

이 method는 String value를 반환합니다. String의 contents는 implementation-defined이지만, host environment의 current locale의 convention에 corresponding하는 convenient, human-readable form으로 current time zone에서 Date의 “date” portion을 represent하도록 intended됩니다.

이 method에 대한 optional parameter의 meaning은 ECMA-402 specification에 defined되어 있습니다; ECMA-402 support를 include하지 않는 implementation은 those parameter position을 anything else에 사용해서는 안 됩니다.

21.4.4.39 Date.prototype.toLocaleString ( [ reserved1 [ , reserved2 ] ] )

ECMA-402 Internationalization API를 include하는 ECMAScript implementation은 ECMA-402 specification에 specified된 대로 이 method를 implement해야 합니다. ECMAScript implementation이 ECMA-402 API를 include하지 않으면 이 method의 following specification이 사용됩니다:

이 method는 String value를 반환합니다. String의 contents는 implementation-defined이지만, host environment의 current locale의 convention에 corresponding하는 convenient, human-readable form으로 current time zone에서 Date를 represent하도록 intended됩니다.

이 method에 대한 optional parameter의 meaning은 ECMA-402 specification에 defined되어 있습니다; ECMA-402 support를 include하지 않는 implementation은 those parameter position을 anything else에 사용해서는 안 됩니다.

21.4.4.40 Date.prototype.toLocaleTimeString ( [ reserved1 [ , reserved2 ] ] )

ECMA-402 Internationalization API를 include하는 ECMAScript implementation은 ECMA-402 specification에 specified된 대로 이 method를 implement해야 합니다. ECMAScript implementation이 ECMA-402 API를 include하지 않으면 이 method의 following specification이 사용됩니다:

이 method는 String value를 반환합니다. String의 contents는 implementation-defined이지만, host environment의 current locale의 convention에 corresponding하는 convenient, human-readable form으로 current time zone에서 Date의 “time” portion을 represent하도록 intended됩니다.

이 method에 대한 optional parameter의 meaning은 ECMA-402 specification에 defined되어 있습니다; ECMA-402 support를 include하지 않는 implementation은 those parameter position을 anything else에 사용해서는 안 됩니다.

21.4.4.41 Date.prototype.toString ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. ToDateString(tv)를 반환한다.
Note 1

d.[[DateValue]]가 1000으로 evenly divisible한 any Date d에 대해, Date.parse(d.toString())의 result는 d.valueOf()와 =입니다. 21.4.3.2를 참조하십시오.

Note 2

이 method는 generic하지 않습니다; this value가 Date가 아니면 TypeError exception을 throw합니다. 따라서 method로 사용하기 위해 other kinds of objects에 transferred될 수 없습니다.

21.4.4.41.1 TimeString ( tv )

The abstract operation TimeString takes argument tv (a Number, but not NaN) and returns a String. It performs the following steps when called:

  1. hourToZeroPaddedDecimalString((HourFromTime(tv)), 2)로 둔다.
  2. minuteToZeroPaddedDecimalString((MinFromTime(tv)), 2)로 둔다.
  3. secondToZeroPaddedDecimalString((SecFromTime(tv)), 2)로 둔다.
  4. hour, ":", minute, ":", second, code unit 0x0020 (SPACE), 및 "GMT"string-concatenation을 반환한다.

21.4.4.41.2 DateString ( tv )

The abstract operation DateString takes argument tv (a Number, but not NaN) and returns a String. It performs the following steps when called:

  1. weekday를 Number WeekDay(tv)를 가진 Table 61 안의 entry의 Name으로 둔다.
  2. month를 Number MonthFromTime(tv)를 가진 Table 62 안의 entry의 Name으로 둔다.
  3. dayToZeroPaddedDecimalString((DateFromTime(tv)), 2)로 둔다.
  4. yvYearFromTime(tv)로 둔다.
  5. yv+0𝔽이거나 yv > +0𝔽이면, yearSign을 empty String으로 둔다; 그렇지 않으면 yearSign"-"로 둔다.
  6. paddedYearToZeroPaddedDecimalString(abs((yv)), 4)로 둔다.
  7. weekday, code unit 0x0020 (SPACE), month, code unit 0x0020 (SPACE), day, code unit 0x0020 (SPACE), yearSign, 및 paddedYearstring-concatenation을 반환한다.
Table 61: Names of days of the week
Number Name
+0𝔽 "Sun"
1𝔽 "Mon"
2𝔽 "Tue"
3𝔽 "Wed"
4𝔽 "Thu"
5𝔽 "Fri"
6𝔽 "Sat"
Table 62: Names of months of the year
Number Name
+0𝔽 "Jan"
1𝔽 "Feb"
2𝔽 "Mar"
3𝔽 "Apr"
4𝔽 "May"
5𝔽 "Jun"
6𝔽 "Jul"
7𝔽 "Aug"
8𝔽 "Sep"
9𝔽 "Oct"
10𝔽 "Nov"
11𝔽 "Dec"

21.4.4.41.3 TimeZoneString ( tv )

The abstract operation TimeZoneString takes argument tv (an integral Number) and returns a String. It performs the following steps when called:

  1. systemTimeZoneIdentifierSystemTimeZoneIdentifier()로 둔다.
  2. IsTimeZoneOffsetString(systemTimeZoneIdentifier)이 true이면, 다음을 수행한다.
    1. offsetNsParseTimeZoneOffsetString(systemTimeZoneIdentifier)로 둔다.
  3. 그렇지 않으면,
    1. offsetNsGetNamedTimeZoneOffsetNanoseconds(systemTimeZoneIdentifier, ((tv) × 106))로 둔다.
  4. offset𝔽(truncate(offsetNs / 106))로 둔다.
  5. offset+0𝔽이거나 offset > +0𝔽이면, 다음을 수행한다.
    1. offsetSign"+"로 둔다.
    2. absOffsetoffset으로 둔다.
  6. 그렇지 않으면,
    1. offsetSign"-"로 둔다.
    2. absOffset을 -offset으로 둔다.
  7. offsetMinToZeroPaddedDecimalString((MinFromTime(absOffset)), 2)로 둔다.
  8. offsetHourToZeroPaddedDecimalString((HourFromTime(absOffset)), 2)로 둔다.
  9. tzName을 empty String이거나 code unit 0x0020 (SPACE), code unit 0x0028 (LEFT PARENTHESIS), implementation-defined timezone name, 및 code unit 0x0029 (RIGHT PARENTHESIS)의 string-concatenationimplementation-defined string으로 둔다.
  10. offsetSign, offsetHour, offsetMin, 및 tzNamestring-concatenation을 반환한다.

21.4.4.41.4 ToDateString ( tv )

The abstract operation ToDateString takes argument tv (an integral Number or NaN) and returns a String. It performs the following steps when called:

  1. tvNaN이면, "Invalid Date"를 반환한다.
  2. localTimeLocalTime(tv)로 둔다.
  3. DateString(localTime), code unit 0x0020 (SPACE), TimeString(localTime), 및 TimeZoneString(tv)의 string-concatenation을 반환한다.

21.4.4.42 Date.prototype.toTimeString ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, "Invalid Date"를 반환한다.
  5. localTimeLocalTime(tv)로 둔다.
  6. TimeString(localTime)과 TimeZoneString(tv)의 string-concatenation을 반환한다.

21.4.4.43 Date.prototype.toUTCString ( )

이 method는 this value에 corresponding하는 instant in time을 represent하는 String value를 반환합니다. String의 format은 RFC 7231의 HTTP-date를 기반으로 하며, ECMAScript Dates가 support하는 full range of times를 support하도록 generalized됩니다.

called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. tvdateObj.[[DateValue]]로 둔다.
  4. tvNaN이면, "Invalid Date"를 반환한다.
  5. weekday를 Number WeekDay(tv)를 가진 Table 61 안의 entry의 Name으로 둔다.
  6. month를 Number MonthFromTime(tv)를 가진 Table 62 안의 entry의 Name으로 둔다.
  7. dayToZeroPaddedDecimalString((DateFromTime(tv)), 2)로 둔다.
  8. yvYearFromTime(tv)로 둔다.
  9. yv+0𝔽이거나 yv > +0𝔽이면, yearSign을 empty String으로 둔다; 그렇지 않으면 yearSign"-"로 둔다.
  10. paddedYearToZeroPaddedDecimalString(abs((yv)), 4)로 둔다.
  11. weekday, ",", code unit 0x0020 (SPACE), day, code unit 0x0020 (SPACE), month, code unit 0x0020 (SPACE), yearSign, paddedYear, code unit 0x0020 (SPACE), 및 TimeString(tv)의 string-concatenation을 반환한다.

21.4.4.44 Date.prototype.valueOf ( )

이 method는 called될 때 following steps를 수행합니다:

  1. dateObjthis value로 둔다.
  2. RequireInternalSlot(dateObj, [[DateValue]])를 수행한다.
  3. dateObj.[[DateValue]]를 반환한다.

21.4.4.45 Date.prototype [ %Symbol.toPrimitive% ] ( hint )

이 method는 ECMAScript language operator가 Date를 primitive value로 convert하기 위해 called합니다. hint에 allowed되는 values는 "default", "number", 및 "string"입니다. Date는 "default""string"과 equivalent하게 treat한다는 점에서 built-in ECMAScript object 중 unique합니다. all other built-in ECMAScript objects는 "default""number"와 equivalent하게 treat합니다.

called될 때 following steps를 수행합니다:

  1. objthis value로 둔다.
  2. obj가 Object가 아니면, TypeError exception을 throw한다.
  3. hint"string" 또는 "default" 중 하나이면, 다음을 수행한다.
    1. tryFirststring으로 둔다.
  4. 그렇지 않고 hint"number"이면, 다음을 수행한다.
    1. tryFirstnumber로 둔다.
  5. 그렇지 않으면,
    1. TypeError exception을 throw한다.
  6. OrdinaryToPrimitive(obj, tryFirst)를 반환한다.

이 property는 attributes { [[Writable]]: false, [[Enumerable]]: false, [[Configurable]]: true }를 가집니다.

이 method의 "name" property의 value는 "[Symbol.toPrimitive]"입니다.

21.4.5 Properties of Date Instances

Date instance는 Date prototype object에서 property를 inherit하는 ordinary object입니다. Date instance는 또한 [[DateValue]] internal slot을 가집니다. [[DateValue]] internal slot은 이 Date가 represented하는 time value입니다.