mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 09:45:06 +02:00
LibWeb/HTML: Reuse number to date string conversion helper
This shares the code to convert to a date string for this algorithm and the valueAsNumber implementation.
This commit is contained in:
Notes:
github-actions[bot]
2025-03-06 14:02:26 +00:00
Author: https://github.com/shannonbooth Commit: https://github.com/LadybirdBrowser/ladybird/commit/f344eca39d8 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3830
@@ -2289,7 +2289,7 @@ String HTMLInputElement::covert_date_to_string(GC::Ref<JS::Date> input) const
|
||||
if (type_state() == TypeAttributeState::Date) {
|
||||
// Return a valid date string that represents the date current at the time represented by input in the UTC time zone.
|
||||
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#valid-date-string
|
||||
return MUST(String::formatted("{:04d}-{:02d}-{:02d}", JS::year_from_time(input->date_value()), JS::month_from_time(input->date_value()) + 1, JS::date_from_time(input->date_value())));
|
||||
return convert_number_to_date_string(input->date_value());
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/input.html#time-state-(type=time):concept-input-value-string-date
|
||||
|
||||
Reference in New Issue
Block a user