diff --git a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp index b8aabf494c..b24bc03a15 100644 --- a/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp +++ b/Userland/Libraries/LibJS/Runtime/Temporal/AbstractOperations.cpp @@ -1663,7 +1663,9 @@ ThrowCompletionOr parse_temporal_time_zone_string(GlobalObject auto fraction = String::formatted("{}000000000", *fraction_part); // ii. Let nanoseconds be the String value equal to the substring of fraction from 1 to 10. // iii. Set nanoseconds to ! ToIntegerOrInfinity(nanoseconds). - nanoseconds = *fraction.substring(1, 10).to_int(); + // FIXME: 1-10 is wrong and should be 0-9; the decimal separator is no longer present in the parsed string. + // See: https://github.com/tc39/proposal-temporal/pull/1999 + nanoseconds = *fraction.substring(0, 9).to_int(); } // h. Else, else { diff --git a/Userland/Libraries/LibJS/Tests/builtins/Temporal/TimeZone/TimeZone.from.js b/Userland/Libraries/LibJS/Tests/builtins/Temporal/TimeZone/TimeZone.from.js index 04b85097f6..8ae6222b95 100644 --- a/Userland/Libraries/LibJS/Tests/builtins/Temporal/TimeZone/TimeZone.from.js +++ b/Userland/Libraries/LibJS/Tests/builtins/Temporal/TimeZone/TimeZone.from.js @@ -30,14 +30,12 @@ describe("normal behavior", () => { ["1970-01-01T00:00:00.000000000+01:00:00", "+01:00"], ["1970-01-01+12:34", "+12:34"], ["1970-01-01+12:34:56", "+12:34:56"], - // FIXME: These currently crash :^( - // ["1970-01-01+12:34:56.789", "+12:34:56.789"], - // ["1970-01-01+12:34:56.789[-01:00]", "+12:34:56.789"], + ["1970-01-01+12:34:56.789", "+12:34:56.789"], + ["1970-01-01+12:34:56.789[-01:00]", "+12:34:56.789"], ["1970-01-01-12:34", "-12:34"], ["1970-01-01-12:34:56", "-12:34:56"], - // FIXME: These currently crash :^( - // ["1970-01-01-12:34:56.789", "-12:34:56.789"], - // ["1970-01-01-12:34:56.789[+01:00]", "-12:34:56.789"], + ["1970-01-01-12:34:56.789", "-12:34:56.789"], + ["1970-01-01-12:34:56.789[+01:00]", "-12:34:56.789"], ]; for (const [arg, expected] of values) { expect(Temporal.TimeZone.from(arg).id).toBe(expected);