Skip to content

Commit bdad8ad

Browse files
fix: add 2 digit milliseconds with tz to standard formats
1 parent e7994c7 commit bdad8ad

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/dates/parse-date.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const standardDateFormats = [
2525
"E MMM dd yyyy HH:mm:ss",
2626
"yyyy-MM-ddTHH:mm:ss.SSSSSSSXXX",
2727
"yyyy-MM-ddTHH:mm:ss.SSSXXX",
28+
"yyyy-MM-ddTHH:mm:ss.SSXXX",
2829
"yyyy-MM-ddTHH:mm:ssXXX",
2930
"yyyy-MM-ddTHH:mm:ss.SSSSSSS",
3031
"yyyy-MM-ddTHH:mm:ss.SSS",

test/dates.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,10 @@ describe('date parsing', () => {
926926
expect(+parseDate("2000-10-10T14:30+03:30", "yyyy-MM-ddTHH:mmXXX")).toEqual(Date.parse("2000-10-10T14:30+03:30"));
927927
});
928928

929+
it("parses iso8601 with 2 digit milliseconds and timezone without specified format", () => {
930+
expect(parseDate("2000-10-10T14:30:00.03+02:00")).toEqual(new Date(2000, 9, 10, 15, 30, 0, 30));
931+
});
932+
929933
it("parses datetime with timezone offset (hours)", () => {
930934
expect(+parseDate("2000-10-10 14:30 +01", "yyyy-MM-dd HH:mm X")).toEqual(Date.parse("2000-10-10T14:30+01:00"));
931935
});

0 commit comments

Comments
 (0)