diff --git a/Userland/Libraries/LibJS/Runtime/Date.cpp b/Userland/Libraries/LibJS/Runtime/Date.cpp index 08968714c7..5ccb2d7048 100644 --- a/Userland/Libraries/LibJS/Runtime/Date.cpp +++ b/Userland/Libraries/LibJS/Runtime/Date.cpp @@ -269,28 +269,6 @@ u8 week_day(double t) return static_cast(modulo(day(t) + 4, 7)); } -// 21.4.1.7 LocalTZA ( t, isUTC ), https://tc39.es/ecma262/#sec-local-time-zone-adjustment -// FIXME: Remove this when ECMA-402 is synced with https://github.com/tc39/ecma262/commit/43fd5f25357333d8340bfb486b8f0738e6d0d0cb. -double local_tza(double time, [[maybe_unused]] bool is_utc, Optional time_zone_override) -{ - // The time_zone_override parameter is non-standard, but allows callers to override the system - // time zone with a specific value without setting environment variables. - auto time_zone = time_zone_override.value_or(TimeZone::current_time_zone()); - - // When isUTC is true, LocalTZA( tUTC, true ) should return the offset of the local time zone from - // UTC measured in milliseconds at time represented by time value tUTC. When the result is added to - // tUTC, it should yield the corresponding Number tlocal. - - // When isUTC is false, LocalTZA( tlocal, false ) should return the offset of the local time zone from - // UTC measured in milliseconds at local time represented by Number tlocal. When the result is subtracted - // from tlocal, it should yield the corresponding time value tUTC. - - auto time_since_epoch = Value(time).is_finite_number() ? AK::Time::from_milliseconds(time) : AK::Time::max(); - auto maybe_offset = TimeZone::get_time_zone_offset(time_zone, time_since_epoch); - - return maybe_offset.has_value() ? static_cast(maybe_offset->seconds) * 1000 : 0; -} - // 21.4.1.7 GetUTCEpochNanoseconds ( year, month, day, hour, minute, second, millisecond, microsecond, nanosecond ), https://tc39.es/ecma262/#sec-getutcepochnanoseconds Crypto::SignedBigInteger get_utc_epoch_nanoseconds(i32 year, u8 month, u8 day, u8 hour, u8 minute, u8 second, u16 millisecond, u16 microsecond, u16 nanosecond) { diff --git a/Userland/Libraries/LibJS/Runtime/Date.h b/Userland/Libraries/LibJS/Runtime/Date.h index ea01a0693f..8cf6808fda 100644 --- a/Userland/Libraries/LibJS/Runtime/Date.h +++ b/Userland/Libraries/LibJS/Runtime/Date.h @@ -62,7 +62,6 @@ u8 min_from_time(double); u8 sec_from_time(double); u16 ms_from_time(double); u8 week_day(double); -double local_tza(double time, bool is_utc, Optional time_zone_override = {}); Crypto::SignedBigInteger get_utc_epoch_nanoseconds(i32 year, u8 month, u8 day, u8 hour, u8 minute, u8 second, u16 millisecond, u16 microsecond, u16 nanosecond); Vector get_named_time_zone_epoch_nanoseconds(StringView time_zone_identifier, i32 year, u8 month, u8 day, u8 hour, u8 minute, u8 second, u16 millisecond, u16 microsecond, u16 nanosecond); i64 get_named_time_zone_offset_nanoseconds(StringView time_zone_identifier, Crypto::SignedBigInteger const& epoch_nanoseconds);