diff --git a/jquery.datetimepicker.js b/jquery.datetimepicker.js index 7c7a6df..60956b6 100644 --- a/jquery.datetimepicker.js +++ b/jquery.datetimepicker.js @@ -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)) {