inputmask
Advanced tools
Comparing version 5.0.6-beta.29 to 5.0.6-beta.31
@@ -9,2 +9,3 @@ # Change Log | ||
### Fixed | ||
- cant enter the leap year using jit masking #2453 | ||
- Basically the same issue appears also when you have a valid date in the input but want to change something. #2435 | ||
@@ -11,0 +12,0 @@ - Can't remove "placeholder" from datetime alias #2438 |
@@ -150,3 +150,3 @@ /* | ||
|| (!isFinite(dateParts.rawday) && new Date(dateParts.date.getFullYear(), isFinite(dateParts.rawmonth) ? dateParts.month : dateParts.date.getMonth() + 1, 0).getDate() >= dateParts.day) | ||
|| (dateParts.day == "29" && !isFinite(dateParts.rawyear)) | ||
|| (dateParts.day == "29" && (!isFinite(dateParts.rawyear) || dateParts.rawyear === undefined || dateParts.rawyear === "")) | ||
|| new Date(dateParts.date.getFullYear(), isFinite(dateParts.rawmonth) ? dateParts.month : dateParts.date.getMonth() + 1, 0).getDate() >= dateParts.day) { | ||
@@ -270,6 +270,6 @@ return currentResult; | ||
//padding function | ||
function pad(val, len) { | ||
function pad(val, len, right) { | ||
val = String(val); | ||
len = len || 2; | ||
while (val.length < len) val = "0" + val; | ||
while (val.length < len) val = right ? val + "0" : "0" + val; | ||
return val; | ||
@@ -287,2 +287,8 @@ } | ||
let datavalue = dateObj[targetProp]; | ||
if ((targetProp === "day" && parseInt(datavalue) === 29) || (targetProp === "month" && parseInt(datavalue) === 2)) { | ||
if (parseInt(dateObj.day) === 29 && parseInt(dateObj.month) === 2 && (dateObj.year === "" || dateObj.year === undefined)) { | ||
//set temporary leap year in dateObj | ||
dateObj.date.setFullYear(2012, 1, 29); | ||
} | ||
} | ||
if (targetProp === "day" && parseInt(datavalue) === 0) | ||
@@ -292,3 +298,5 @@ datavalue = 1; | ||
datavalue -= 1; | ||
dateOperation.call(dateObj.date, datavalue); | ||
if (targetProp === "year" && datavalue.length < 4) | ||
datavalue = pad(datavalue, 4, true); | ||
if (datavalue !== "") dateOperation.call(dateObj.date, datavalue); | ||
} | ||
@@ -461,3 +469,3 @@ } | ||
if (pos && result && currentResult.pos !== pos) { | ||
if (pos !== undefined && result && currentResult.pos !== pos) { | ||
return { | ||
@@ -464,0 +472,0 @@ buffer: parse(opts.inputFormat, dateParts, opts).split(""), |
{ | ||
"name": "inputmask", | ||
"version": "5.0.6-beta.29", | ||
"version": "5.0.6-beta.31", | ||
"description": "Inputmask is a javascript library which creates an input mask. Inputmask can run against vanilla javascript, jQuery and jqlite.", | ||
@@ -5,0 +5,0 @@ "main": "dist/inputmask.js", |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
11052
990630
39