1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 04:57:44 +00:00

LibJS: Implement the ECMA-402 definition of DefaultTimeZone

Simply defer to LibTimeZone to retrieve the system's current time zone.
Also update some Temporal tests to explicitly set the time zone to UTC.
This commit is contained in:
Timothy Flynn 2022-01-11 23:23:41 -05:00 committed by Linus Groh
parent bdf02c21e1
commit f6786881aa
6 changed files with 10 additions and 10 deletions

View file

@ -56,11 +56,11 @@ String canonicalize_time_zone_name(String const& time_zone)
}
// 11.1.3 DefaultTimeZone ( ), https://tc39.es/proposal-temporal/#sec-defaulttimezone
// NOTE: This is the minimum implementation of DefaultTimeZone, supporting only the "UTC" time zone.
// 15.1.3 DefaultTimeZone ( ), https://tc39.es/proposal-temporal/#sup-defaulttimezone
String default_time_zone()
{
// 1. Return "UTC".
return "UTC";
// The DefaultTimeZone abstract operation returns a String value representing the valid (11.1.1) and canonicalized (11.1.2) time zone name for the host environment's current time zone.
return ::TimeZone::current_time_zone();
}
// 11.6.1 ParseTemporalTimeZone ( string ), https://tc39.es/proposal-temporal/#sec-temporal-parsetemporaltimezone