Skip to content

Commit bd26c2c

Browse files
author
T_S_V
committed
Work for #228 - Bootstrap datepicker - need to use UTC
1 parent 233cce3 commit bd26c2c

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/bootstrapdatepicker.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,16 @@ function init(Survey, $) {
102102
daysOfWeekHighlighted: question.daysOfWeekHighlighted,
103103
disableTouchKeyboard: question.disableTouchKeyboard,
104104
})
105-
// .on("changeDate", function (e) {
106-
// question.value = moment(e.date).format("DD/MM/YYYY");
107-
// // `e` here contains the extra attributes
108-
// })
109105
.on("change", function (e) {
110-
var newValue = pickerWidget.val();
106+
var newDate = pickerWidget.bootstrapDP("getUTCDate");
107+
var newValue = newDate && newDate.toUTCString();
111108
if (question.value != newValue) {
112109
question.value = newValue;
113110
}
114111
});
115112

116113
question.valueChangedCallback = function () {
117-
// pickerWidget.val(question.value);
118-
// $el.bootstrapDP('update', moment(question.value, "DD/MM/YYYY").toDate());
119-
pickerWidget.bootstrapDP("update", !!question.value ? new Date(question.value) : "");
114+
pickerWidget.bootstrapDP("setUTCDate", !!question.value ? new Date(question.value) : "");
120115
};
121116
question.valueChangedCallback();
122117
question.readOnlyChangedCallback = function () {

0 commit comments

Comments
 (0)