Skip to content

Commit d182bd2

Browse files
JAMSUPREMEmattbaileyuk
authored andcommittedNov 2, 2021
Adjusting occurrence
1 parent 7bea75b commit d182bd2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed
 

‎src/datetime.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ const dateTime = (function () {
10301030
// Note, syntax based on https://www.w3.org/TR/xpath-functions-31/#date-time-examples
10311031
matcher.type = 'integer';
10321032
const isUpper = formatSpec.case === tcase.UPPER;
1033-
const mandatoryDigits = formatSpec.mandatoryDigits && formatSpec.mandatoryDigits > 0 ? formatSpec.mandatoryDigits.toString() : '+';
1033+
const occurrences = formatSpec.mandatoryDigits && formatSpec.mandatoryDigits > 0 ? `{${formatSpec.mandatoryDigits}}` : '+';
10341034
switch (formatSpec.primary) {
10351035
case formats.LETTERS:
10361036
matcher.regex = isUpper ? '[A-Z]+' : '[a-z]+';
@@ -1051,7 +1051,7 @@ const dateTime = (function () {
10511051
};
10521052
break;
10531053
case formats.DECIMAL:
1054-
matcher.regex = `[0-9]{${mandatoryDigits}}`;
1054+
matcher.regex = `[0-9]${occurrences}`;
10551055
if (formatSpec.ordinal) {
10561056
// ordinals
10571057
matcher.regex += '(?:th|st|nd|rd)';

0 commit comments

Comments
 (0)
Please sign in to comment.