Skip to content

Commit

Permalink
test: ISO date string millisecond parsing (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
gkarapeev authored Jan 15, 2021
1 parent b5ee6b7 commit 197372b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/dates.js
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,12 @@ describe('date parsing', () => {
expect(parseDate("2000-10-10T14:30:0.0400000Z", "yyyy-MM-ddTHH:mm:ss.SSSSSSSX").getMilliseconds()).toEqual(40);
});

it('parses first digit of ISO date string milliseconds as hundreds', () => {
expect(parseDate("2000-01-01T00:00:00.1Z").getMilliseconds()).toEqual(100);
expect(parseDate("2000-01-01T00:00:00.10Z").getMilliseconds()).toEqual(100);
expect(parseDate("2000-01-01T00:00:00.100Z").getMilliseconds()).toEqual(100);
});

it("parses UTC milliseconds without specified format", () => {
const utcDate = new Date(Date.UTC(2000, 9, 10, 14, 30, 0, 450));
expect(parseDate("2000-10-10T14:30:0.45Z").getMilliseconds()).toEqual(utcDate.getMilliseconds());
Expand Down

0 comments on commit 197372b

Please sign in to comment.