Merge pull request #670 from KyleMit/bugfix/paste

fixes #669 fix paste error overflowing mask length
This commit is contained in:
Valeriy Chupurnov 2018-06-28 19:14:12 +05:00 committed by GitHub
commit 00c84bec27
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)) {