Przeglądaj źródła

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.
Linus Groh 4 lat temu
rodzic
commit
ba9d3bc38c

+ 1 - 1
Userland/Libraries/LibJS/Runtime/DateConstructor.cpp

@@ -159,7 +159,7 @@ Value DateConstructor::construct(Function&)
     }
     }
 
 
     auto create_invalid_date = [this]() {
     auto create_invalid_date = [this]() {
-        auto datetime = Core::DateTime::from_timestamp(static_cast<time_t>(0));
+        auto datetime = Core::DateTime::create(1970, 1, 1, 0, 0, 0);
         auto milliseconds = static_cast<u16>(0);
         auto milliseconds = static_cast<u16>(0);
         return Date::create(global_object(), datetime, milliseconds, true);
         return Date::create(global_object(), datetime, milliseconds, true);
     };
     };