|
|
@@ -3,7 +3,7 @@
|
|
|
* https://github.com/RobinHerbots/Inputmask
|
|
|
* Copyright (c) 2010 - 2020 Robin Herbots
|
|
|
* Licensed under the MIT license
|
|
|
- * Version: 5.0.4-beta.31
|
|
|
+ * Version: 5.0.4-beta.32
|
|
|
*/
|
|
|
!function webpackUniversalModuleDefinition(root, factory) {
|
|
|
if ("object" == typeof exports && "object" == typeof module) module.exports = factory(require("jquery")); else if ("function" == typeof define && define.amd) define([ "jquery" ], factory); else {
|
|
|
@@ -1945,19 +1945,28 @@
|
|
|
function prefillYear(dateParts, currentResult, opts) {
|
|
|
if (dateParts.year !== dateParts.rawyear) {
|
|
|
var crrntyear = currentYear.toString(), enteredPart = dateParts.rawyear.replace(/[^0-9]/g, ""), currentYearPart = crrntyear.slice(0, enteredPart.length), currentYearNextPart = crrntyear.slice(enteredPart.length);
|
|
|
- 2 === enteredPart.length && enteredPart === currentYearPart && (!opts.max || opts.max.date.getTime() >= new Date(crrntyear, dateParts.month - 1, dateParts.day).getTime()) && (dateParts.date.setFullYear(crrntyear),
|
|
|
- dateParts.year = crrntyear, currentResult.insert = [ {
|
|
|
- pos: currentResult.pos + 1,
|
|
|
- c: currentYearNextPart[0]
|
|
|
- }, {
|
|
|
- pos: currentResult.pos + 2,
|
|
|
- c: currentYearNextPart[1]
|
|
|
- } ]);
|
|
|
+ if (2 === enteredPart.length && enteredPart === currentYearPart) {
|
|
|
+ var entryCurrentYear = new Date(currentYear, dateParts.month - 1, dateParts.day);
|
|
|
+ dateParts.day === entryCurrentYear.getDay() && (!opts.max || opts.max.date.getTime() >= entryCurrentYear.getTime()) && (dateParts.date.setFullYear(currentYear),
|
|
|
+ dateParts.year = crrntyear, currentResult.insert = [ {
|
|
|
+ pos: currentResult.pos + 1,
|
|
|
+ c: currentYearNextPart[0]
|
|
|
+ }, {
|
|
|
+ pos: currentResult.pos + 2,
|
|
|
+ c: currentYearNextPart[1]
|
|
|
+ } ]);
|
|
|
+ }
|
|
|
}
|
|
|
return currentResult;
|
|
|
}
|
|
|
- function isValidDate(dateParts, currentResult) {
|
|
|
- return (!isFinite(dateParts.rawday) || "29" == dateParts.day && !isFinite(dateParts.rawyear) || new Date(dateParts.date.getFullYear(), isFinite(dateParts.rawmonth) ? dateParts.month : dateParts.date.getMonth() + 1, 0).getDate() >= dateParts.day) && currentResult;
|
|
|
+ function isValidDate(dateParts, currentResult, opts) {
|
|
|
+ if (!isFinite(dateParts.rawday) || "29" == dateParts.day && !isFinite(dateParts.rawyear) || new Date(dateParts.date.getFullYear(), isFinite(dateParts.rawmonth) ? dateParts.month : dateParts.date.getMonth() + 1, 0).getDate() >= dateParts.day) return currentResult;
|
|
|
+ if ("29" == dateParts.day) {
|
|
|
+ var tokenMatch = getTokenMatch(currentResult.pos, opts);
|
|
|
+ if ("yyyy" === tokenMatch.targetMatch[0] && currentResult.pos - tokenMatch.targetMatchIndex == 2) return currentResult.remove = currentResult.pos + 1,
|
|
|
+ currentResult;
|
|
|
+ }
|
|
|
+ return !1;
|
|
|
}
|
|
|
function isDateInRange(dateParts, result, opts, maskset, fromCheckval) {
|
|
|
if (!result) return result;
|
|
|
@@ -2123,7 +2132,7 @@
|
|
|
}
|
|
|
var result = currentResult, dateParts = analyseMask(buffer.join(""), opts.inputFormat, opts);
|
|
|
return result && dateParts.date.getTime() == dateParts.date.getTime() && (result = prefillYear(dateParts, result, opts),
|
|
|
- result = isValidDate(dateParts, result), result = isDateInRange(dateParts, result, opts, maskset, fromCheckval)),
|
|
|
+ result = isValidDate(dateParts, result, opts), result = isDateInRange(dateParts, result, opts, maskset, fromCheckval)),
|
|
|
pos && result && currentResult.pos !== pos ? {
|
|
|
buffer: parse(opts.inputFormat, dateParts, opts).split(""),
|
|
|
refreshFromBuffer: {
|