friendica-github/view/templates/field_datetime.tpl

48 lines
1.6 KiB
Smarty
Raw Normal View History

2024-08-24 18:23:27 +00:00
{{*
* Copyright (C) 2010-2024, the Friendica project
* SPDX-FileCopyrightText: 2010-2024 the Friendica project
*
* SPDX-License-Identifier: AGPL-3.0-or-later
*}}
2024-01-07 20:48:22 +00:00
{{include file="field_input.tpl" field=$field}}
2018-03-04 13:56:51 +00:00
<script type="text/javascript">
$(function () {
$('#id_{{$field.0}}').datetimepicker({
step: 5,
format: '{{$datetimepicker.dateformat}}',
{{if $datetimepicker.minDate}}
minDate: new Date({{$datetimepicker.minDate->getTimestamp()}} * 1000),
yearStart: {{$datetimepicker.minDate->format('Y')}},
{{/if}}
{{if $datetimepicker.maxDate}}
maxDate: new Date({{$datetimepicker.maxDate->getTimestamp()}} * 1000),
yearEnd: {{$datetimepicker.maxDate->format('Y')}},
{{/if}}
{{if $datetimepicker.defaultDate}}
defaultDate: new Date({{$datetimepicker.defaultDate->getTimestamp()}} * 1000),
{{/if}}
dayOfWeekStart: {{$datetimepicker.firstDay}},
lang: '{{$datetimepicker.lang}}'
});
2018-03-04 13:56:51 +00:00
{{if $datetimepicker.lang}}
jQuery.datetimepicker.setLocale('{{$datetimepicker.lang}}');
{{/if}}
{{if $datetimepicker.minfrom }}
$('#id_{{$datetimepicker.minfrom}}').data('xdsoft_datetimepicker').setOptions({
onChangeDateTime: function (currentDateTime) {
$('#id_{{$field.0}}').data('xdsoft_datetimepicker').setOptions({minDate: currentDateTime});
}
});
{{/if}}
{{if $datetimepicker.maxfrom }}
$('#id_{{$datetimepicker.maxfrom}}').data('xdsoft_datetimepicker').setOptions({
onChangeDateTime: function (currentDateTime) {
$('#id_{{$field.0}}').data('xdsoft_datetimepicker').setOptions({maxDate: currentDateTime});
}
});
{{/if}}
})
</script>