Skip to content

Commit de2ba9f

Browse files
authored
fix(calendar): return null instead of undefined in sanitizer
The date sanitizer returns undefined when the date argument is not a valid date object or date string which doesn't allow to reset the date value especially for min and max date by passing null value via `set minDate` and `set MaxDate`. This PR makes the `sanitiseDate` method to return null if the value of date argument is not valid date object or date string. Close: #1776
1 parent aa04e6d commit de2ba9f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/definitions/modules/calendar.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,14 +1074,11 @@ $.fn.calendar = function(parameters) {
10741074
return null;
10751075
},
10761076
sanitiseDate: function (date) {
1077-
if (!date) {
1078-
return undefined;
1079-
}
10801077
if (!(date instanceof Date)) {
10811078
date = parser.date('' + date, settings);
10821079
}
1083-
if (!date || date === null || isNaN(date.getTime())) {
1084-
return undefined;
1080+
if (!date || isNaN(date.getTime())) {
1081+
return null;
10851082
}
10861083
return date;
10871084
},

0 commit comments

Comments
 (0)