From f344eca39d876e6192fd7066a7ce904ccc126bd2 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Thu, 6 Mar 2025 15:29:46 +1300 Subject: [PATCH] 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. --- Libraries/LibWeb/HTML/HTMLInputElement.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 93de597f58f..ec44c4eefd2 100644 --- a/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -2289,7 +2289,7 @@ String HTMLInputElement::covert_date_to_string(GC::Ref 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