From ef522190fb59c5149dbb7f08405d18cb5d6cd300 Mon Sep 17 00:00:00 2001 From: Steven Date: Thu, 24 Mar 2016 19:56:14 +1300 Subject: [PATCH] Fix exception when mask isn't set or is false. Added an additional check to ensure options.mask is a string as it is set to false when not using masks. Fixes #414 --- jquery.datetimepicker.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jquery.datetimepicker.js b/jquery.datetimepicker.js index 42f49b0..d840ed9 100755 --- a/jquery.datetimepicker.js +++ b/jquery.datetimepicker.js @@ -1164,7 +1164,7 @@ input .off('blur.xdsoft') .on('blur.xdsoft', function () { - if (options.allowBlank && (!$.trim($(this).val()).length || $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_'))) { + if (options.allowBlank && (!$.trim($(this).val()).length || (typeof options.mask == "string" && $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_')))) { $(this).val(null); datetimepicker.data('xdsoft_datetime').empty(); } else if (!dateHelper.parseDate($(this).val(), options.format)) {