mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-21 09:49:21 +00:00
LibJS: Allow date format "YYYY-M-DD"
This commit is contained in:
parent
6481ef821d
commit
b4d996680a
Notes:
github-actions[bot]
2024-09-15 16:25:28 +00:00
Author: https://github.com/Arhcout
Commit: b4d996680a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1398
2 changed files with 3 additions and 1 deletions
|
@ -180,6 +180,7 @@ static double parse_date_string(VM& vm, ByteString const& date_string)
|
|||
"%a%t%b%t%e%t%T%t%Y"sv, // "Wed Apr 17 23:08:53 2019"
|
||||
"%Y-%m-%eT%T%X%z"sv, // "2024-01-26T22:10:11.306+0000"
|
||||
"%m/%e/%Y,%t%T%t%p"sv, // "1/27/2024, 9:28:30 AM"
|
||||
"%Y-%m-%e"sv, // "2024-1-15"
|
||||
};
|
||||
|
||||
for (auto const& format : extra_formats) {
|
||||
|
|
|
@ -16,6 +16,8 @@ test("basic functionality", () => {
|
|||
|
||||
const originalTimeZone = setTimeZone("UTC");
|
||||
|
||||
expect(Date.parse("1980-5-30")).toBe(328492800000);
|
||||
|
||||
setTimeZone("America/Chicago");
|
||||
expect(Date.parse("Jan 01 1970 GMT")).toBe(0);
|
||||
expect(Date.parse("Wed Apr 17 23:08:53 2019 +0000")).toBe(1555542533000);
|
||||
|
@ -42,7 +44,6 @@ test("basic functionality", () => {
|
|||
expect(Date.parse("1980-05-00T")).toBe(NaN);
|
||||
expect(Date.parse("1980-05-00T15:15:")).toBe(NaN);
|
||||
expect(Date.parse("1980-05-00T15:15:15.")).toBe(NaN);
|
||||
expect(Date.parse("1980-5-30")).toBe(NaN);
|
||||
expect(Date.parse("1980-05-30T13")).toBe(NaN);
|
||||
expect(Date.parse("1980-05-30T13:4")).toBe(NaN);
|
||||
expect(Date.parse("1980-05-30T13:40+")).toBe(NaN);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue