fixes #669 fix paste error overflowing mask length

This commit is contained in:
Kyle 2018-06-14 18:18:48 -04:00 committed by GitHub
parent 11a13e949c
commit 83bc5ef2e3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2370,7 +2370,7 @@ var datetimepickerFactory = function ($) {
setCaretPos(input[0], 0);
}
input.on('paste.xdsoft', function (event) {
input.off('paste.xdsoft').on('paste.xdsoft', function (event) {
// couple options here
// 1. return false - tell them they can't paste
// 2. insert over current characters - minimal validation
@ -2388,7 +2388,8 @@ var datetimepickerFactory = function ($) {
var valueBeforeCursor = val.substr(0, pos);
var valueAfterPaste = val.substr(pos + pastedData.length);
val = valueBeforeCursor + pastedData + valueAfterPaste;
val = valueBeforeCursor + pastedData + valueAfterPaste;
val = val.substring(0, options.mask.length)
pos += pastedData.length;
if (isValidValue(options.mask, val)) {