mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 00:19:53 +01:00
LibJS: Parse dates like "2021-04-21T15:00:00+0000"
This is used on figma.com
This commit is contained in:
parent
3ab4efb7ef
commit
30507681f7
|
|
@ -194,6 +194,7 @@ static double parse_date_string(VM& vm, StringView date_string)
|
|||
"%a%t%b%t%e%t%Y"sv, // "Wed Nov 20 2024"
|
||||
"%Y-%m-%d%t%H:%M:%S%z"sv, // "2024-12-30 03:00:00+0000"
|
||||
"%Y-%m-%d%t%H:%M:%S%X"sv, // "2025-01-13 00:00:00.000"
|
||||
"%Y-%m-%eT%T%z"sv, // "2021-04-21T15:00:00+0000"
|
||||
};
|
||||
|
||||
for (auto const& format : extra_formats) {
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ test("basic functionality", () => {
|
|||
expect(Date.parse("2025-01-02 14:00:00+0000")).toBe(1735826400000);
|
||||
expect(Date.parse("Wednesday, Jan 15, 2025")).toBe(1736920800000);
|
||||
expect(Date.parse("2025-01-13 00:00:00.000")).toBe(1736748000000);
|
||||
expect(Date.parse("2021-04-21T15:00:00+0000")).toBe(1619017200000);
|
||||
|
||||
// FIXME: Create a scoped time zone helper when bytecode supports the `using` declaration.
|
||||
setTimeZone(originalTimeZone);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user