Skip to content

Commit 5d668f7

Browse files
committed
Ten or more digit precision should fail
1 parent 636e4c7 commit 5d668f7

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

parse.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export class IsoDateParts {
66
};
77

88
static FULL_DATE_REGEX = /^([+-]\d{6}|\d{4})-?([01]\d)-?([0-3]\d)$/;
9-
static DATETIME_REGEX = /^([+-]\d{6}|\d{4})-?([01]\d)-?([0-3]\d)[Tt ]([0-2]\d(?:[\.\,]\d+)?)(?::?([0-5]\d(?:[\.\,]\d+)?)(?::?([0-5]\d))?(?:[\.\,](\d+))?)?(Z|[+-][0-2]\d(?::?[0-5]\d)?)?$/;
9+
static DATETIME_REGEX = /^([+-]\d{6}|\d{4})-?([01]\d)-?([0-3]\d)[Tt ]([0-2]\d(?:[\.\,]\d+)?)(?::?([0-5]\d(?:[\.\,]\d+)?)(?::?([0-5]\d))?(?:[\.\,](\d{1,9}))?)?(Z|[+-][0-2]\d(?::?[0-5]\d)?)?$/;
1010
static TIMEZONE_REGEX = /^([+-]\d{2})(?::?(\d{2}))?$/;
1111
static IS_FRACTIONAL_REGEX = /^\d+[\.\,]\d+$/;
1212

test/utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ export const INVALID_TEST_CASES = `
141141
09:24:15
142142
09:24:15.123
143143
09:24:15,123
144+
145+
// Ten digit precision not supported (RFC 9557)
146+
20250721T152640.3965097519
147+
20250721T152640,3965097519
144148
`
145149

146150
// Some Date/DateTime tests cribbed from https://ijmacd.github.io/rfc3339-iso8601/

0 commit comments

Comments
 (0)