mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-21 23:20:20 +00:00
LibJS: Parse dates like "November 19 2024 00:00:00 +0900"
This format is used on https://jojowiki.com/ to show countdowns to new releases.
This commit is contained in:
parent
d796f609db
commit
956b279ae1
Notes:
github-actions[bot]
2024-11-12 12:24:27 +00:00
Author: https://github.com/Lubrsi Commit: https://github.com/LadybirdBrowser/ladybird/commit/956b279ae1f Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2297
2 changed files with 2 additions and 0 deletions
|
@ -191,6 +191,7 @@ static double parse_date_string(VM& vm, ByteString const& date_string)
|
|||
"%d%t%b%t%Y"sv, // "01 Jan 2000"
|
||||
"%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"
|
||||
};
|
||||
|
||||
for (auto const& format : extra_formats) {
|
||||
|
|
|
@ -40,6 +40,7 @@ test("basic functionality", () => {
|
|||
expect(Date.parse("1/27/2024, 9:28:30 AM")).toBe(1706369310000);
|
||||
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);
|
||||
|
||||
// FIXME: Create a scoped time zone helper when bytecode supports the `using` declaration.
|
||||
setTimeZone(originalTimeZone);
|
||||
|
|
Loading…
Reference in a new issue