mirror of
https://github.com/xdan/datetimepicker.git
synced 2024-11-18 06:24:22 +00:00
fixes #669 fix paste error overflowing mask length
This commit is contained in:
parent
11a13e949c
commit
83bc5ef2e3
@ -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)) {
|
||||
|
Loading…
Reference in New Issue
Block a user