Skip to content

Commit cf152e2

Browse files
authored
fix(calendar): shortyear handling was broken
the short year settings centuryBreak and currentCentury were broken/not respected
1 parent ff78834 commit cf152e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/definitions/modules/calendar.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,8 @@
16991699
text = settings.monthFirst || !/^\d{1,2}[./-]/.test(text) ? text : text.replace(/[./-]/g, '/').replace(/(\d+)\/(\d+)/, '$2/$1');
17001700
var textDate = new Date(text);
17011701
var numberOnly = text.match(/^\d+$/) !== null;
1702-
if (!numberOnly && !isNaN(textDate.getDate())) {
1702+
var isShortYear = text.match(/^(?:\d{1,2}[./-]){2}\d{1,2}$/) !== null;
1703+
if (!isShortYear && !numberOnly && !isNaN(textDate.getDate())) {
17031704
return textDate;
17041705
}
17051706
text = text.toLowerCase();

0 commit comments

Comments
 (0)