We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c16ba7b commit e6e436dCopy full SHA for e6e436d
src/datetime.js
@@ -1028,7 +1028,17 @@ const dateTime = (function () {
1028
} else { // type === 'integer'
1029
matcher.type = 'integer';
1030
const isUpper = formatSpec.case === tcase.UPPER;
1031
- const occurrences = formatSpec.n && formatSpec.n > 0 ? `{${formatSpec.n}}` : '+';
+ let occurrences;
1032
+ if(formatSpec.n && formatSpec.n > 0){
1033
+ if(formatSpec.optionalDigits === 0){
1034
+ occurrences = `{${formatSpec.n}}`;
1035
+ } else {
1036
+ occurrences = `{${formatSpec.n - formatSpec.optionalDigits},${formatSpec.n}}`;
1037
+ }
1038
1039
+ occurrences = '+';
1040
1041
+
1042
switch (formatSpec.primary) {
1043
case formats.LETTERS:
1044
matcher.regex = isUpper ? '[A-Z]+' : '[a-z]+';
0 commit comments