mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 18:17:22 +02:00
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:
committed by
Andrew Kaster
parent
8f8e51b1fc
commit
6fb2be96bf
Notes:
github-actions[bot]
2025-06-20 00:44:11 +00:00
Author: https://github.com/tomaszstrejczek Commit: https://github.com/LadybirdBrowser/ladybird/commit/6fb2be96bf6 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5096 Reviewed-by: https://github.com/ADKaster ✅ Reviewed-by: https://github.com/R-Goc Reviewed-by: https://github.com/gmta
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user