Skip to content

Commit b0ddadd

Browse files
JAMSUPREMEmattbaileyuk
authored andcommittedNov 2, 2021
Adjusting for non-negative n
1 parent d182bd2 commit b0ddadd

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed
 

‎src/datetime.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -983,6 +983,7 @@ const dateTime = (function () {
983983
return offsetHours * 60 + offsetMinutes;
984984
};
985985
} else if (part.integerFormat) {
986+
part.integerFormat.n = part.n;
986987
res = generateRegex(part.integerFormat);
987988
} else {
988989
// must be a month or day name
@@ -1030,7 +1031,11 @@ const dateTime = (function () {
10301031
// Note, syntax based on https://www.w3.org/TR/xpath-functions-31/#date-time-examples
10311032
matcher.type = 'integer';
10321033
const isUpper = formatSpec.case === tcase.UPPER;
1033-
const occurrences = formatSpec.mandatoryDigits && formatSpec.mandatoryDigits > 0 ? `{${formatSpec.mandatoryDigits}}` : '+';
1034+
// const mandatoryDigits = formatSpec.mandatoryDigits && formatSpec.mandatoryDigits > 0 ? formatSpec.mandatoryDigits : 0;
1035+
// const optionalDigits = formatSpec.optionalDigits && formatSpec.optionalDigits > 0 ? formatSpec.optionalDigits : 0;
1036+
// const totalDigits = mandatoryDigits + optionalDigits;
1037+
// eslint-disable-next-line no-unused-vars
1038+
const occurrences = formatSpec.n && formatSpec.n > 1 ? `{${formatSpec.n}}` : '+';
10341039
switch (formatSpec.primary) {
10351040
case formats.LETTERS:
10361041
matcher.regex = isUpper ? '[A-Z]+' : '[a-z]+';

0 commit comments

Comments
 (0)
Please sign in to comment.