Everywhere: Replace DateTime::to_string() with UnixDateTime::to_string()

Replace LibCore::DateTime::to_string() with
AK::UnixDateTime::to_string().
Remove unncessary #include <LibCore/DateTime.h>.
This commit is contained in:
Tomasz Strejczek 2025-06-19 21:05:42 +02:00 committed by Andrew Kaster
parent 8f8e51b1fc
commit 6fb2be96bf
Notes: github-actions[bot] 2025-06-20 00:44:11 +00:00
13 changed files with 25 additions and 30 deletions

View file

@ -11,7 +11,6 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibCore/DateTime.h>
#include <LibJS/Runtime/Date.h>
#include <LibJS/Runtime/NativeFunction.h>
#include <LibJS/Runtime/RegExpObject.h>
@ -2326,8 +2325,8 @@ static String convert_number_to_date_string(double input)
// The algorithm to convert a number to a string, given a number input, is as follows: Return a valid
// date string that represents the date that, in UTC, is current input milliseconds after midnight UTC
// on the morning of 1970-01-01 (the time represented by the value "1970-01-01T00:00:00.0Z").
auto date = Core::DateTime::from_timestamp(input / 1000.);
return MUST(date.to_string("%Y-%m-%d"sv, Core::DateTime::LocalTime::No));
auto date = AK::UnixDateTime::from_seconds_since_epoch(input / 1000.);
return MUST(date.to_string("%Y-%m-%d"sv));
}
// https://html.spec.whatwg.org/multipage/input.html#time-state-(type=time):concept-input-value-number-string