mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-22 09:12:13 -05:00
LibJS: Parse dates like "2025-01-13 00:00:00.000"
This is used on figma.com.
This commit is contained in:
parent
915c36c366
commit
3ab4efb7ef
Notes:
github-actions[bot]
2025-01-21 20:37:06 +00:00
Author: https://github.com/Lubrsi Commit: https://github.com/LadybirdBrowser/ladybird/commit/3ab4efb7efe Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3239 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/kalenikaliaksandr
2 changed files with 2 additions and 0 deletions
|
@ -193,6 +193,7 @@ static double parse_date_string(VM& vm, StringView date_string)
|
|||
"%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"
|
||||
"%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"
|
||||
};
|
||||
|
||||
for (auto const& format : extra_formats) {
|
||||
|
|
|
@ -45,6 +45,7 @@ test("basic functionality", () => {
|
|||
expect(Date.parse("Wed Nov 20 2024")).toBe(1732082400000);
|
||||
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);
|
||||
|
||||
// FIXME: Create a scoped time zone helper when bytecode supports the `using` declaration.
|
||||
setTimeZone(originalTimeZone);
|
||||
|
|
Loading…
Reference in a new issue