Skip to content

Commit 197372b

Browse files
authored
test: ISO date string millisecond parsing (#105)
1 parent b5ee6b7 commit 197372b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

test/dates.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,12 @@ describe('date parsing', () => {
927927
expect(parseDate("2000-10-10T14:30:0.0400000Z", "yyyy-MM-ddTHH:mm:ss.SSSSSSSX").getMilliseconds()).toEqual(40);
928928
});
929929

930+
it('parses first digit of ISO date string milliseconds as hundreds', () => {
931+
expect(parseDate("2000-01-01T00:00:00.1Z").getMilliseconds()).toEqual(100);
932+
expect(parseDate("2000-01-01T00:00:00.10Z").getMilliseconds()).toEqual(100);
933+
expect(parseDate("2000-01-01T00:00:00.100Z").getMilliseconds()).toEqual(100);
934+
});
935+
930936
it("parses UTC milliseconds without specified format", () => {
931937
const utcDate = new Date(Date.UTC(2000, 9, 10, 14, 30, 0, 450));
932938
expect(parseDate("2000-10-10T14:30:0.45Z").getMilliseconds()).toEqual(utcDate.getMilliseconds());

0 commit comments

Comments
 (0)