diff --git a/src/utilities/time.test.ts b/src/utilities/time.test.ts index 70e0c45bc5..06453aaa53 100644 --- a/src/utilities/time.test.ts +++ b/src/utilities/time.test.ts @@ -282,6 +282,17 @@ test('parseDoyOrYmdTime', () => { year: 2022, }); + expect(parseDoyOrYmdTime('2022-10-2T00:00:00')).toEqual({ + day: 2, + hour: 0, + min: 0, + month: 10, + ms: 0, + sec: 0, + time: '00:00:00', + year: 2022, + }); + expect(parseDoyOrYmdTime('012T03:01:30.920')).toEqual({ days: 12, hours: 3, diff --git a/src/utilities/time.ts b/src/utilities/time.ts index 2d1c3ab2d9..c9a61446a4 100644 --- a/src/utilities/time.ts +++ b/src/utilities/time.ts @@ -773,7 +773,7 @@ export function parseDoyOrYmdTime( ): null | ParsedDoyString | ParsedYmdString | ParsedDurationString { const matches = (dateString ?? '').match( new RegExp( - `^(?\\d{4})-(?:(?(?:[0]?[0-9])|(?:[1][1-2]))-(?(?:[0-2]?[0-9])|(?:[3][0-1]))|(?\\d{1,3}))(?:T(?