Skip to content

Commit a6f3690

Browse files
authored
Bugfix: Make ISO monthCode abstract operations match polyfill. (#1362)
This is subject to further change based on IETF standardization of monthCodes; it is not going to be defined by temporal. Fixes #1348.
1 parent 02339c6 commit a6f3690

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

spec/calendar.html

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,11 @@ <h1>ResolveISOMonth ( _fields_ )</h1>
299299
1. If _monthCode_ is *undefined*, then
300300
1. If _month_ is *undefined*, throw a *TypeError* exception.
301301
1. Return _month_.
302-
1. Let _numberPart_ be ! ToNumber(_monthCode_).
302+
1. Assert: Type(_monthCode_) is String.
303+
1. Let _monthLength_ be the length of _monthCode_.
304+
1. If _monthLength_ is not 3, throw a *RangeError* exception.
305+
1. Let _numberPart_ be the substring of _monthCode_ from 2.
306+
1. Set _numberPart_ to ! ToIntegerOrInfinity(_numberPart_).
303307
1. If _numberPart_ is *NaN*, throw a *RangeError* exception.
304308
1. If _month_ is not *undefined*, and _month__numberPart_, then
305309
1. Throw a *RangeError* exception.
@@ -409,7 +413,8 @@ <h1>ISOMonthCode ( _dateOrDateTime_ )</h1>
409413
<emu-alg>
410414
1. If _dateOrDateTime_ does not have an [[ISOMonth]] internal slot, then
411415
1. Set _dateOrDateTime_ to ? ToTemporalDate(_dateOrDateTime_).
412-
1. Return ! ES.ToString(_dateOrDateTime_.[[ISOMonth]]).
416+
1. Let _monthCode_ be the String representation of _dateOrDateTime_.[[ISOMonth]], formatted as a two-digit decimal number, padded to the left with the code unit 0x0030 (DIGIT ZERO) if necessary.
417+
1. Return the string-concatenation of *"M"* and _monthCode_.
413418
</emu-alg>
414419
</emu-clause>
415420

0 commit comments

Comments
 (0)