mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-28 07:18:51 +00: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:
parent
13f9670f20
commit
f344eca39d
Notes:
github-actions[bot]
2025-03-06 14:02:26 +00:00
Author: https://github.com/shannonbooth
Commit: f344eca39d
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3830
1 changed files with 1 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue