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.
This commit is contained in:
Linus Groh 2021-06-06 17:07:17 +01:00 committed by Andreas Kling
parent ff5aa3ca70
commit ba9d3bc38c
Notes: sideshowbarker 2024-07-18 12:45:00 +09:00

View file

@ -159,7 +159,7 @@ Value DateConstructor::construct(Function&)
}
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);
return Date::create(global_object(), datetime, milliseconds, true);
};