Skip to content

Commit 0f11bd6

Browse files
committed
Normative: Fix ambiguity in FractionalPart grammar
In ParseISODateTime, where the algorithm refers to "the part of _isoString_ produced by the |TimeFractionalPart| production", it is ambiguous whether this means the fractional part of the seconds in the time representation, or the fractional part of the seconds in the UTC-offset-named time zone. That is, in the following string, 2021-09-01T02:03:04.56789+23:12:07.987654321[+11:22:33.444445555] it could refer to "56789" or "444445555" This fixes the ambiguity by eliminating TimeFractionalPart and referencing TimeFraction wherever TimeFractionalPart was previously referenced. Note that TimeFraction includes the decimal separator as well, where TimeFractionalPart did not, so string indices have to increase by one. Closes: #1794
1 parent 8b7ba00 commit 0f11bd6

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

spec/abstractops.html

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -825,11 +825,8 @@ <h1>ISO 8601 grammar</h1>
825825
FractionalPart :
826826
DecimalDigit DecimalDigit? DecimalDigit? DecimalDigit? DecimalDigit? DecimalDigit? DecimalDigit? DecimalDigit? DecimalDigit?
827827

828-
TimeFractionalPart :
829-
FractionalPart
830-
831828
Fraction :
832-
DecimalSeparator TimeFractionalPart
829+
DecimalSeparator FractionalPart
833830

834831
TimeFraction :
835832
Fraction
@@ -1071,7 +1068,7 @@ <h1>ParseISODateTime ( _isoString_ )</h1>
10711068
<emu-note>The value of ? ToIntegerOrInfinity(*undefined*) is 0.</emu-note>
10721069
<emu-alg>
10731070
1. Assert: Type(_isoString_) is String.
1074-
1. Let _year_, _month_, _day_, _hour_, _minute_, _second_, _fraction_, and _calendar_ be the parts of _isoString_ produced respectively by the |DateYear|, |DateMonth|, |DateDay|, |TimeHour|, |TimeMinute|, |TimeSecond|, |TimeFractionalPart|, and |CalendarName| productions, or *undefined* if not present.
1071+
1. Let _year_, _month_, _day_, _hour_, _minute_, _second_, _fraction_, and _calendar_ be the parts of _isoString_ produced respectively by the |DateYear|, |DateMonth|, |DateDay|, |TimeHour|, |TimeMinute|, |TimeSecond|, |TimeFraction|, and |CalendarName| productions, or *undefined* if not present.
10751072
1. If the first code unit of _year_ is 0x2212 (MINUS SIGN), replace it with the code unit 0x002D (HYPHEN-MINUS).
10761073
1. Set _year_ to ! ToIntegerOrInfinity(_year_).
10771074
1. If _month_ is *undefined*, then
@@ -1089,11 +1086,11 @@ <h1>ParseISODateTime ( _isoString_ )</h1>
10891086
1. Set _second_ to 59.
10901087
1. If _fraction_ is not *undefined*, then
10911088
1. Set _fraction_ to the string-concatenation of the previous value of _fraction_ and the string *"000000000"*.
1092-
1. Let _millisecond_ be the String value equal to the substring of _fraction_ from 0 to 3.
1089+
1. Let _millisecond_ be the String value equal to the substring of _fraction_ from 1 to 4.
10931090
1. Set _millisecond_ to ! ToIntegerOrInfinity(_millisecond_).
1094-
1. Let _microsecond_ be the String value equal to the substring of _fraction_ from 3 to 6.
1091+
1. Let _microsecond_ be the String value equal to the substring of _fraction_ from 4 to 7.
10951092
1. Set _microsecond_ to ! ToIntegerOrInfinity(_microsecond_).
1096-
1. Let _nanosecond_ be the String value equal to the substring of _fraction_ from 6 to 9.
1093+
1. Let _nanosecond_ be the String value equal to the substring of _fraction_ from 7 to 10.
10971094
1. Set _nanosecond_ to ! ToIntegerOrInfinity(_nanosecond_).
10981095
1. Else,
10991096
1. Let _millisecond_ be 0.

0 commit comments

Comments
 (0)