From 197372be5c3bf0ca08f76bd5a58731dc531fb71f Mon Sep 17 00:00:00 2001 From: Georgi K <45083324+gkarapeev@users.noreply.github.com> Date: Fri, 15 Jan 2021 10:17:16 +0200 Subject: [PATCH] test: ISO date string millisecond parsing (#105) --- test/dates.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/dates.js b/test/dates.js index e27212a9..6388cf5b 100644 --- a/test/dates.js +++ b/test/dates.js @@ -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());