LibWeb/HTML: Implement <input> element valueAsNumber for 'week'
Some checks are pending
CI / Lagom (x86_64, Fuzzers_CI, false, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, false, ubuntu-24.04, Linux, GNU) (push) Waiting to run
CI / Lagom (x86_64, Sanitizer_CI, true, ubuntu-24.04, Linux, Clang) (push) Waiting to run
CI / Lagom (arm64, Sanitizer_CI, false, macos-15, macOS, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-24.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Label PRs with merge conflicts / auto-labeler (push) Waiting to run
Push notes / build (push) Waiting to run

One point to note is that I am not entirely sure what the result
of the pre-existing valueAsNumber test should be for this strange
case which does not lie exactly on a week/day boundary. Chrome
gives a negative timestamp, which seems more wrong than the result
we give, and neither gecko or WebKit appear to support the 'week'
type. So I'm considering this result acceptable for now, and this
may be something that will need more WPT tests added in the future.
This commit is contained in:
Shannon Booth 2025-02-07 17:24:35 +13:00 committed by Sam Atkins
commit 6e257897f6
Notes: github-actions[bot] 2025-02-22 19:10:40 +00:00
5 changed files with 120 additions and 8 deletions

View file

@ -28,6 +28,13 @@ struct YearAndMonth {
u32 month;
};
Optional<YearAndMonth> parse_a_month_string(StringView);
struct WeekYearAndWeek {
u32 week_year;
u32 week;
};
Optional<WeekYearAndWeek> parse_a_week_string(StringView);
i32 number_of_months_since_unix_epoch(YearAndMonth);
}