mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:57:45 +00:00
LibJS: Fix fraction substring in ParseTimeZoneOffsetString
This is a normative change in the Temporal spec. See: -97d553c
-d53af7f
Note that we already implemented this correctly, so the only change is updating the spec comment.
This commit is contained in:
parent
356fa2dca1
commit
619794dfa7
1 changed files with 4 additions and 1 deletions
|
@ -296,7 +296,10 @@ ThrowCompletionOr<double> parse_time_zone_offset_string(GlobalObject& global_obj
|
||||||
if (fraction_part.has_value()) {
|
if (fraction_part.has_value()) {
|
||||||
// a. Set fraction to the string-concatenation of the previous value of fraction and the string "000000000".
|
// a. Set fraction to the string-concatenation of the previous value of fraction and the string "000000000".
|
||||||
auto fraction = String::formatted("{}000000000", *fraction_part);
|
auto fraction = String::formatted("{}000000000", *fraction_part);
|
||||||
// b. Let nanoseconds be the String value equal to the substring of fraction consisting of the code units with indices 0 (inclusive) through 9 (exclusive).
|
|
||||||
|
// b. Let nanoseconds be the String value equal to the substring of fraction from 1 to 10.
|
||||||
|
// NOTE: parse_time_zone_numeric_utc_offset_syntax(), which we use to capture TimeZoneUTCOffsetFraction, doesn't include the decimal separator.
|
||||||
|
|
||||||
// c. Set nanoseconds to ! ToIntegerOrInfinity(nanoseconds).
|
// c. Set nanoseconds to ! ToIntegerOrInfinity(nanoseconds).
|
||||||
nanoseconds = *fraction.substring(0, 9).to_int<i32>();
|
nanoseconds = *fraction.substring(0, 9).to_int<i32>();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue