mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-22 08:00:45 +00:00
This reimplements conversions between unix date times and ISO8601 weeks. The new algorithms also do not use loops, so they should be faster.
83 lines
1.7 KiB
HTML
83 lines
1.7 KiB
HTML
<!DOCTYPE html>
|
|
<script src="./include.js"></script>
|
|
<script>
|
|
const test_cases = [
|
|
"1970-W01",
|
|
|
|
"2000-W02",
|
|
"2000-W51",
|
|
"2000-W52",
|
|
"2001-W01",
|
|
"2001-W02",
|
|
"2001-W51",
|
|
"2001-W52",
|
|
"2002-W01",
|
|
"2002-W02",
|
|
"2002-W51",
|
|
"2002-W52",
|
|
"2003-W01",
|
|
"2003-W02",
|
|
"2003-W51",
|
|
"2003-W52",
|
|
"2004-W01",
|
|
"2004-W02",
|
|
"2004-W51",
|
|
"2004-W52",
|
|
"2004-W53",
|
|
"2005-W01",
|
|
"2005-W02",
|
|
"2005-W51",
|
|
"2005-W52",
|
|
"2006-W01",
|
|
"2006-W02",
|
|
"2006-W51",
|
|
"2006-W52",
|
|
"2007-W01",
|
|
"2007-W02",
|
|
"2007-W51",
|
|
"2007-W52",
|
|
"2008-W01",
|
|
"2008-W02",
|
|
"2008-W51",
|
|
"2008-W52",
|
|
"2009-W01",
|
|
"2009-W02",
|
|
"2009-W51",
|
|
"2009-W52",
|
|
"2009-W53",
|
|
|
|
"2064-W25",
|
|
"1976-W20",
|
|
"2036-W06",
|
|
"2022-W09",
|
|
"2049-W19",
|
|
"2069-W09",
|
|
"2015-W46",
|
|
"2056-W42",
|
|
"2018-W23",
|
|
"2047-W02",
|
|
"2033-W41",
|
|
"2021-W52",
|
|
"1987-W08",
|
|
"1982-W13",
|
|
"1979-W36",
|
|
"2057-W43",
|
|
"1988-W35",
|
|
"2060-W50",
|
|
"2013-W14",
|
|
"2005-W52",
|
|
];
|
|
|
|
test(() => {
|
|
for (const test_case of test_cases) {
|
|
const input = document.createElement("input");
|
|
input.type = "week";
|
|
input.value = test_case;
|
|
if (input.value === test_case) {
|
|
println(`${test_case} -> ${input.valueAsNumber}`);
|
|
} else {
|
|
println("FAIL");
|
|
}
|
|
}
|
|
});
|
|
</script>
|