|
|
|
@ -55,38 +55,35 @@
@@ -55,38 +55,35 @@
|
|
|
|
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js"></script> |
|
|
|
|
<script type="text/javascript"> |
|
|
|
|
$(function () { |
|
|
|
|
'{% if not form.start_time_disabled.data %}' |
|
|
|
|
var startDate = new Date() |
|
|
|
|
'{% else %}' |
|
|
|
|
var startDate = null |
|
|
|
|
'{% endif %}' |
|
|
|
|
|
|
|
|
|
'{% if not form.end_time_disabled.data %}' |
|
|
|
|
var endDate = new Date() |
|
|
|
|
'{% else %}' |
|
|
|
|
var endDate = null |
|
|
|
|
'{% endif %}' |
|
|
|
|
|
|
|
|
|
var date = moment() |
|
|
|
|
$('#datetimepicker_start').datetimepicker({ |
|
|
|
|
//useCurrent: false, //Important! See issue #1075 |
|
|
|
|
locale: 'en-gb', |
|
|
|
|
format: 'DD-MM-YYYY HH:mm', |
|
|
|
|
keepInvalid: true, |
|
|
|
|
sideBySide: true, |
|
|
|
|
defaultDate: startDate, |
|
|
|
|
defaultDate: null, |
|
|
|
|
timeZone: moment.tz.guess() |
|
|
|
|
}); |
|
|
|
|
//date.setDate(date.getDate() + 1) |
|
|
|
|
'{% if not form.start_time_disabled.data and not form.start_time %}' |
|
|
|
|
$('#datetimepicker_start')[0].value = date.format('DD-MM-YYYY HH:mm'); |
|
|
|
|
date.add(1, 'hour'); |
|
|
|
|
'{% endif %}' |
|
|
|
|
$('#datetimepicker_end').datetimepicker({ |
|
|
|
|
//useCurrent: false, //Important! See issue #1075 |
|
|
|
|
locale: 'en-gb', |
|
|
|
|
format: 'DD-MM-YYYY HH:mm', |
|
|
|
|
keepInvalid: true, |
|
|
|
|
sideBySide: true, |
|
|
|
|
defaultDate: endDate, |
|
|
|
|
defaultDate: null, |
|
|
|
|
timeZone: moment.tz.guess() |
|
|
|
|
}); |
|
|
|
|
var date = new Date() |
|
|
|
|
'{% if not form.end_time_disabled.data and not form.end_time %}' |
|
|
|
|
$('#datetimepicker_end')[0].value = date.format('DD-MM-YYYY HH:mm'); |
|
|
|
|
'{% endif %}' |
|
|
|
|
|
|
|
|
|
$("#datetimepicker_start").on("dp.change", function (e) { |
|
|
|
|
$('#datetimepicker_end').data("DateTimePicker").minDate(e.date); |
|
|
|
|
}); |
|
|
|
@ -105,6 +102,9 @@
@@ -105,6 +102,9 @@
|
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
$(picker).data("DateTimePicker").enable(); |
|
|
|
|
if ($(picker).data("DateTimePicker") == null){ |
|
|
|
|
$(picker).data("DateTimePicker") = moment().format('DD-MM-YYYY HH:mm'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
updateDateTimePicker('#datetimepicker_start', '#start_time_disabled'); |
|
|
|
|