diff options
author | Linus Groh <mail@linusgroh.de> | 2022-05-06 19:10:34 +0200 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-05-06 22:32:47 +0200 |
commit | 4dd9102f5edb44645913ad9c0ca9aa6bceee73b4 (patch) | |
tree | 3f40e0e0f1ced71b5f57683a2bb81be6e1e1f31e /Userland/Libraries/LibJS/Runtime/Date.h | |
parent | 9bec9c2b7885e69c8b54764f9529d891f2d61233 (diff) | |
download | serenity-4dd9102f5edb44645913ad9c0ca9aa6bceee73b4.zip |
LibJS: Move Hours/Minutes/Seconds/ms constants out of the Date class
They can remain in this header, but will be used outside the Date
context in Temporal.
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Date.h')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Date.h | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Date.h b/Userland/Libraries/LibJS/Runtime/Date.h index 7b8fcd1b31..25748c9030 100644 --- a/Userland/Libraries/LibJS/Runtime/Date.h +++ b/Userland/Libraries/LibJS/Runtime/Date.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020-2021, Linus Groh <linusg@serenityos.org> + * Copyright (c) 2020-2022, Linus Groh <linusg@serenityos.org> * Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org> * * SPDX-License-Identifier: BSD-2-Clause @@ -26,25 +26,25 @@ public: String iso_date_string() const; - // https://tc39.es/ecma262/#eqn-HoursPerDay - static constexpr double hours_per_day = 24; - // https://tc39.es/ecma262/#eqn-MinutesPerHour - static constexpr double minutes_per_hour = 60; - // https://tc39.es/ecma262/#eqn-SecondsPerMinute - static constexpr double seconds_per_minute = 60; - // https://tc39.es/ecma262/#eqn-msPerSecond - static constexpr double ms_per_second = 1'000; - // https://tc39.es/ecma262/#eqn-msPerMinute - static constexpr double ms_per_minute = 60'000; - // https://tc39.es/ecma262/#eqn-msPerHour - static constexpr double ms_per_hour = 3'600'000; - // https://tc39.es/ecma262/#eqn-msPerDay - static constexpr double ms_per_day = 86'400'000; - private: double m_date_value { 0 }; // [[DateValue]] }; +// https://tc39.es/ecma262/#eqn-HoursPerDay +constexpr double hours_per_day = 24; +// https://tc39.es/ecma262/#eqn-MinutesPerHour +constexpr double minutes_per_hour = 60; +// https://tc39.es/ecma262/#eqn-SecondsPerMinute +constexpr double seconds_per_minute = 60; +// https://tc39.es/ecma262/#eqn-msPerSecond +constexpr double ms_per_second = 1'000; +// https://tc39.es/ecma262/#eqn-msPerMinute +constexpr double ms_per_minute = 60'000; +// https://tc39.es/ecma262/#eqn-msPerHour +constexpr double ms_per_hour = 3'600'000; +// https://tc39.es/ecma262/#eqn-msPerDay +constexpr double ms_per_day = 86'400'000; + u16 day_within_year(double); u8 date_from_time(double); u16 days_in_year(i32); |