mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-25 00:50:22 +00:00
LibJS: Parse dates like "Wed Nov 20 2024"
This commit is contained in:
parent
dabf3da7e5
commit
74b27d620d
Notes:
github-actions[bot]
2024-11-20 09:21:48 +00:00
Author: https://github.com/rmg-x Commit: https://github.com/LadybirdBrowser/ladybird/commit/74b27d620da Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2451 Reviewed-by: https://github.com/tcl3 ✅
2 changed files with 2 additions and 0 deletions
|
@ -192,6 +192,7 @@ static double parse_date_string(VM& vm, ByteString const& date_string)
|
|||
"%d%t%b%t%Y%t%R"sv, // "01 Jan 2000 08:00"
|
||||
"%A,%t%B%t%e,%t%Y,%t%R%t%Z"sv, // "Tuesday, October 29, 2024, 18:00 UTC"
|
||||
"%B%t%d%t%Y%t%T%t%z"sv, // "November 19 2024 00:00:00 +0900"
|
||||
"%a%t%b%t%e%t%Y"sv // "Wed Nov 20 2024"
|
||||
};
|
||||
|
||||
for (auto const& format : extra_formats) {
|
||||
|
|
|
@ -41,6 +41,7 @@ test("basic functionality", () => {
|
|||
expect(Date.parse("01 February 2013")).toBe(1359698400000);
|
||||
expect(Date.parse("Tuesday, October 29, 2024, 18:00 UTC")).toBe(1730224800000);
|
||||
expect(Date.parse("November 19 2024 00:00:00 +0900")).toBe(1731942000000);
|
||||
expect(Date.parse("Wed Nov 20 2024")).toBe(1732082400000);
|
||||
|
||||
// FIXME: Create a scoped time zone helper when bytecode supports the `using` declaration.
|
||||
setTimeZone(originalTimeZone);
|
||||
|
|
Loading…
Reference in a new issue