From ba9d3bc38c90e0823b9c7848713826f672a0cd64 Mon Sep 17 00:00:00 2001 From: Linus Groh Date: Sun, 6 Jun 2021 17:07:17 +0100 Subject: [PATCH] LibJS: Create 1970-01-01 00:00:00 local time Date for invalid ctor call When using Core::DateTime::from_timestamp(0) the resulting Date is 1970-01-01 00:00:00 in UTC, which might be something different in local time - this is incorrect and relevant as invalid Dates can be made valid later on. --- Userland/Libraries/LibJS/Runtime/DateConstructor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp b/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp index e77d7e2d1e1..9d21a7907f3 100644 --- a/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp +++ b/Userland/Libraries/LibJS/Runtime/DateConstructor.cpp @@ -159,7 +159,7 @@ Value DateConstructor::construct(Function&) } auto create_invalid_date = [this]() { - auto datetime = Core::DateTime::from_timestamp(static_cast(0)); + auto datetime = Core::DateTime::create(1970, 1, 1, 0, 0, 0); auto milliseconds = static_cast(0); return Date::create(global_object(), datetime, milliseconds, true); };