@@ -919,42 +919,51 @@ contributors: Google, Ecma International
919
919
</emu-alg>
920
920
</emu-clause>
921
921
922
- <emu-clause id="sup-temporal-integerfrommonthcode " type="implementation-defined abstract operation">
922
+ <emu-clause id="sup-temporal-parsemonthcode " type="implementation-defined abstract operation">
923
923
<h1>
924
- IntegerFromMonthCode (
924
+ ParseMonthCode (
925
925
_monthCode_: a String,
926
- ): an integer
926
+ ): an Record with fields [[Number]] (an integer) and [[IsLeap]] (a boolean)
927
927
</h1>
928
928
<dl class="header">
929
929
<dt>description</dt>
930
930
<dd>
931
- It returns the integer number contained in _monthCode_ .
931
+ It parses a valid month code string (such as one returned by ToMonthCode or CreateMonthCode) into its parts .
932
932
</dd>
933
933
</dl>
934
934
<p>It performs the following steps when called:</p>
935
935
<emu-alg>
936
- 1. Assert: The length of _monthCode_ is 3 or 4.
936
+ 1. If the length of _monthCode_ is 3, then
937
+ 1. Let _isLeap_ be *false*.
938
+ 1. Else,
939
+ 1. Assert: the length of _monthCode_ is 4.
940
+ 1. Let _isLeap_ be *true*.
937
941
1. Let _monthCodeDigits_ be the substring of _monthCode_ from 1 to 3.
938
- 1. Return ℝ(StringToNumber(_monthCodeDigits_)).
942
+ 1. Let _number_ be ℝ(StringToNumber(_monthCodeDigits_)).
943
+ 1. Return the Record { [[Number]]: _number_, [[IsLeap]]: _isLeap_ }.
939
944
</emu-alg>
940
945
</emu-clause>
941
946
942
- <emu-clause id="sup-temporal-monthcodefrominteger " type="implementation-defined abstract operation">
947
+ <emu-clause id="sup-temporal-createmonthcode " type="implementation-defined abstract operation">
943
948
<h1>
944
- MonthCodeFromInteger (
945
- _integer_: an integer,
949
+ CreateMonthCode (
950
+ _number_: an integer,
951
+ _isLeap_: a Boolean,
946
952
): a String
947
953
</h1>
948
954
<dl class="header">
949
955
<dt>description</dt>
950
956
<dd>
951
- It returns a month code for a non-leap month containing the given integer number .
957
+ It creates a month code with the given month number and leap month flag .
952
958
</dd>
953
959
</dl>
954
960
<p>It performs the following steps when called:</p>
955
961
<emu-alg>
956
962
1. Let _numberPart_ be ToZeroPaddedDecimalString(_integer_, 2).
957
- 1. Return the string-concatenation of the code unit 0x004D (LATIN CAPITAL LETTER M) and _numberPart_.
963
+ 1. If _isLeap_ is *true*, then
964
+ 1. Return the string-concatenation of the code unit 0x004D (LATIN CAPITAL LETTER M), _numberPart_, and the code unit 0x004C (LATIN CAPITAL LETTER L).
965
+ 1. Else,
966
+ 1. Return the string-concatenation of the code unit 0x004D (LATIN CAPITAL LETTER M) and _numberPart_.
958
967
</emu-alg>
959
968
</emu-clause>
960
969
@@ -1061,7 +1070,7 @@ contributors: Google, Ecma International
1061
1070
1. If _calendar_ is *"chinese"*, *"dangi"*, or *"hebrew"*, then
1062
1071
1. If _calendar_ is *"chinese"* or *"dangi"*, then
1063
1072
1. If IsValidMonthCodeForCalendarInYear(_calendar_, _y2_, _monthCode_) is *false*, then
1064
- 1. Set _monthCode_ to MonthCodeFromInteger(IntegerFromMonthCode (_monthCode_)).
1073
+ 1. Set _monthCode_ to CreateMonthCode(ParseMonthCode (_monthCode_).[[Number]], *false* ).
1065
1074
1. Else,
1066
1075
1. Assert: _calendar_ is *"hebrew"*.
1067
1076
1. Let _d2_ be CalendarISOToDate(_calendar_, ! CalendarDateCodesToISO(_calendar_, _y2_, *"M01"*, 1)).
@@ -1074,7 +1083,7 @@ contributors: Google, Ecma International
1074
1083
1. Assert: IsValidMonthCodeForCalendarInYear(_calendar_, _y2_, _monthCode_) is *true*.
1075
1084
1. Let _month_ be CalendarISOToDate(_calendar_, ! CalendarDateCodesToISO(_calendar_, _y2_, _monthCode_, 1)).[[Month]].
1076
1085
1. Else,
1077
- 1. Let _month_ be IntegerFromMonthCode (_monthCode_).
1086
+ 1. Let _month_ be ParseMonthCode (_monthCode_).[[Number]] .
1078
1087
1. Return the Record { [[Year]]: _y2_, [[Month]]: _month_ }.
1079
1088
</emu-alg>
1080
1089
</emu-clause>
0 commit comments