You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the gregorian & Vietnamese language calendar instance, we are unable to parseDate if the date format is yyyy-M-dd.
It is failing only when dates are fallen in months of Tháng 10', 'Tháng 11', 'Tháng 12'
const calendar = $.calendars.instance('gregorian', 'vi')
const date = calendar.parseDate('yyyy-M-dd', '19-Tháng 10-16'); // Throwing invalid literal character
Yes, it accepts the first match only. I've updated the parseDate function to look for the longest match. You can check out v2.1.2 here, or replace the getName function within parseDate with the following:
var getName = function(match, shortNames, longNames, step) {
var names = (doubled(match, step) ? longNames : shortNames);
var index = -1;
for (var i = 0; i < names.length; i++) {
if (value.substr(iValue, names[i].length).toLowerCase() === names[i].toLowerCase()) {
if (index === -1) {
index = i;
} else if (names[i].length > names[index].length) {
index = i;
}
}
}
if (index > -1) {
iValue += names[index].length;
return index + calendar.minMonth;
}
throw ($.calendars.local.unknownNameAt || $.calendars.regionalOptions[''].unknownNameAt).
replace(/\{0\}/, iValue);
};
With the gregorian & Vietnamese language calendar instance, we are unable to parseDate if the date format is yyyy-M-dd.
It is failing only when dates are fallen in months of Tháng 10', 'Tháng 11', 'Tháng 12'
Short names for months in Vietnamese are
Since Tháng 10 contains Tháng 1,
line number 303 in jquery.calendars.plus.js has
is wrongly calculating and subsequent checkLiteral function is throwing error.
The text was updated successfully, but these errors were encountered: