Skip to content

Commit b38df19

Browse files
Andrew Telnov (DevExpress)Andrew Telnov (DevExpress)
authored andcommitted
bug, jQuery picker could be set to null: #2
1 parent 9e524f9 commit b38df19

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/jquery-ui-datepicker.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,22 @@ function init(Survey) {
1515
var $el = $(el).is(".widget-datepicker") ? $(el) : $(el).find(".widget-datepicker");
1616
var pickerWidget = $el.datepicker({
1717
dateFormat: question.dateFormat,
18+
option: {
19+
minDate: null,
20+
maxDate: null
21+
},
1822
onSelect: function(dateText) {
1923
question.value = dateText;
2024
}
2125
});
2226
question.valueChangedCallback = function() {
23-
pickerWidget.datepicker('setDate', new Date(question.value));
27+
if(question.value) {
28+
pickerWidget.datepicker('setDate', new Date(question.value));
29+
} else {
30+
pickerWidget.datepicker('setDate', null);
31+
}
2432
}
2533
question.valueChangedCallback();
26-
if(!question.value) question.value = new Date();
2734
},
2835
willUnmount: function(question, el) {
2936
var $el = $(el).is(".widget-datepicker") ? $(el) : $(el).find(".widget-datepicker");

0 commit comments

Comments
 (0)