diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-01-19 14:18:02 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-19 21:20:41 +0000 |
commit | 70f49d06969c9faf2ed65b745a75e44dbc8b4915 (patch) | |
tree | 53c617f8962ba8d5373815b43f14c28e47b672b6 /Userland/Libraries/LibJS/Runtime/Date.cpp | |
parent | 42c9c57141b33845e63f8028b18ccc71223c2297 (diff) | |
download | serenity-70f49d06969c9faf2ed65b745a75e44dbc8b4915.zip |
LibJS+LibTimeZone+LibUnicode: Indicate whether a time zone is in DST
Return whether the time zone is in DST during the provided time from
TimeZone::get_time_zone_offset,
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Date.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Date.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Date.cpp b/Userland/Libraries/LibJS/Runtime/Date.cpp index 77c251350b..486aa00a43 100644 --- a/Userland/Libraries/LibJS/Runtime/Date.cpp +++ b/Userland/Libraries/LibJS/Runtime/Date.cpp @@ -286,7 +286,8 @@ double local_tza(double time, [[maybe_unused]] bool is_utc, Optional<StringView> 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.value_or(0) * 1000; + + return maybe_offset.has_value() ? static_cast<double>(maybe_offset->seconds) * 1000 : 0; } // 21.4.1.8 LocalTime ( t ), https://tc39.es/ecma262/#sec-localtime |