|
|
|
@ -55,9 +55,7 @@
@@ -55,9 +55,7 @@
|
|
|
|
|
<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 () { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var date = moment() |
|
|
|
|
$('#timezone')[0].value = moment.tz.guess(); |
|
|
|
|
$('#datetimepicker_start').datetimepicker({ |
|
|
|
|
//useCurrent: false, //Important! See issue #1075 |
|
|
|
|
locale: 'en-gb', |
|
|
|
@ -67,10 +65,6 @@
@@ -67,10 +65,6 @@
|
|
|
|
|
defaultDate: null, |
|
|
|
|
timeZone: moment.tz.guess() |
|
|
|
|
}); |
|
|
|
|
'{% 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', |
|
|
|
@ -80,9 +74,6 @@
@@ -80,9 +74,6 @@
|
|
|
|
|
defaultDate: null, |
|
|
|
|
timeZone: moment.tz.guess() |
|
|
|
|
}); |
|
|
|
|
'{% 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); |
|
|
|
@ -102,16 +93,28 @@
@@ -102,16 +93,28 @@
|
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
$(picker).data("DateTimePicker").enable(); |
|
|
|
|
console.log('1') |
|
|
|
|
if ($(picker).data("DateTimePicker") == null){ |
|
|
|
|
console.log('2') |
|
|
|
|
$(picker).data("DateTimePicker") = moment().format('DD-MM-YYYY HH:mm'); |
|
|
|
|
if ($(picker)[0].value == ''){ |
|
|
|
|
$(picker)[0].value = moment().format('DD-MM-YYYY HH:mm'); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
// On page load |
|
|
|
|
var date = moment() |
|
|
|
|
'{% if not form.start_time_disabled.data and not form.start_time.data %}' |
|
|
|
|
$('#datetimepicker_start')[0].value = date.format('DD-MM-YYYY HH:mm'); |
|
|
|
|
date.add(1, 'hour'); |
|
|
|
|
'{% endif %}' |
|
|
|
|
'{% if not form.end_time_disabled.data and not form.end_time.data %}' |
|
|
|
|
$('#datetimepicker_end')[0].value = date.format('DD-MM-YYYY HH:mm'); |
|
|
|
|
'{% endif %}' |
|
|
|
|
updateDateTimePicker('#datetimepicker_start', '#start_time_disabled'); |
|
|
|
|
updateDateTimePicker('#datetimepicker_end', '#end_time_disabled'); |
|
|
|
|
$('#timezone')[0].value = moment.tz.guess(); |
|
|
|
|
'{% if form.start_time.data %}' |
|
|
|
|
$('#datetimepicker_start')[0].value = moment.utc('{{ form.start_time.data }}').local().format('DD-MM-YYYY HH:mm'); |
|
|
|
|
'{% endif %}' |
|
|
|
|
'{% if form.end_time.data %}' |
|
|
|
|
$('#datetimepicker_end')[0].value = moment.utc('{{ form.end_time.data }}').local().format('DD-MM-YYYY HH:mm'); |
|
|
|
|
'{% endif %}' |
|
|
|
|
}); |
|
|
|
|
</script> |
|
|
|
|
{% endblock %} |
|
|
|
|