diff options
author | Timothy Flynn <trflynn89@pm.me> | 2022-01-14 17:58:49 -0500 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-01-15 20:13:48 +0100 |
commit | 34a1dd4257367180eac212647bbc3614d5fb1129 (patch) | |
tree | ea88aaad17de54e88fd36157fa802367f687b975 /Userland/Libraries/LibJS/Runtime/Date.cpp | |
parent | 58ccca6a9dba937ee7c4b48592962be06955688a (diff) | |
download | serenity-34a1dd4257367180eac212647bbc3614d5fb1129.zip |
LibJS: Remove Core::DateTime logic from the Date object :^)
Diffstat (limited to 'Userland/Libraries/LibJS/Runtime/Date.cpp')
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/Date.cpp | 63 |
1 files changed, 0 insertions, 63 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/Date.cpp b/Userland/Libraries/LibJS/Runtime/Date.cpp index b3d59f1c3e..072bf31835 100644 --- a/Userland/Libraries/LibJS/Runtime/Date.cpp +++ b/Userland/Libraries/LibJS/Runtime/Date.cpp @@ -16,24 +16,11 @@ namespace JS { -Date* Date::create(GlobalObject& global_object, Core::DateTime datetime, i16 milliseconds, bool is_invalid) -{ - return global_object.heap().allocate<Date>(global_object, datetime, milliseconds, is_invalid, *global_object.date_prototype()); -} - Date* Date::create(GlobalObject& global_object, double date_value) { return global_object.heap().allocate<Date>(global_object, date_value, *global_object.date_prototype()); } -Date::Date(Core::DateTime datetime, i16 milliseconds, bool is_invalid, Object& prototype) - : Object(prototype) - , m_datetime(datetime) - , m_milliseconds(milliseconds) - , m_is_invalid(is_invalid) -{ -} - Date::Date(double date_value, Object& prototype) : Object(prototype) , m_date_value(date_value) @@ -44,56 +31,6 @@ Date::~Date() { } -tm Date::to_utc_tm() const -{ - time_t timestamp = m_datetime.timestamp(); - struct tm tm; - gmtime_r(×tamp, &tm); - return tm; -} - -int Date::utc_date() const -{ - return to_utc_tm().tm_mday; -} - -int Date::utc_day() const -{ - return to_utc_tm().tm_wday; -} - -int Date::utc_full_year() const -{ - return to_utc_tm().tm_year + 1900; -} - -int Date::utc_hours() const -{ - return to_utc_tm().tm_hour; -} - -int Date::utc_minutes() const -{ - return to_utc_tm().tm_min; -} - -int Date::utc_month() const -{ - return to_utc_tm().tm_mon; -} - -int Date::utc_seconds() const -{ - return to_utc_tm().tm_sec; -} - -String Date::gmt_date_string() const -{ - // Mon, 18 Dec 1995 17:28:35 GMT - // FIXME: Note that we're totally cheating with the timezone part here.. - return datetime().to_string("%a, %e %b %Y %T GMT"); -} - String Date::iso_date_string() const { int year = year_from_time(m_date_value); |