From 4dd9102f5edb44645913ad9c0ca9aa6bceee73b4 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Fri, 6 May 2022 19:10:34 +0200 Subject: 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. --- Userland/Libraries/LibJS/Runtime/Date.h | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'Userland/Libraries/LibJS/Runtime/Date.h') 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 + * Copyright (c) 2020-2022, Linus Groh * Copyright (c) 2022, Tim Flynn * * 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); -- cgit v1.2.3