forked from CGM_Public/pretix_original
Fix datepicker date display when using min/max (Z#23185544)
This commit is contained in:
committed by
GitHub
parent
08eabfa61c
commit
929a2eb6e3
@@ -196,7 +196,15 @@ var form_handlers = function (el) {
|
||||
}
|
||||
if ($(this).is('[data-is-payment-date]'))
|
||||
opts["daysOfWeekDisabled"] = JSON.parse($("body").attr("data-payment-weekdays-disabled"));
|
||||
$(this).datetimepicker(opts);
|
||||
$(this).datetimepicker(opts).on("dp.hide", function() {
|
||||
// when min/max is used in datetimepicker, closing and re-opening the picker opens at the wrong date
|
||||
// therefore keep the current viewDate and re-set it after datetimepicker is done hiding
|
||||
var $dtp = $(this).data("DateTimePicker");
|
||||
var currentViewDate = $dtp.viewDate();
|
||||
window.setTimeout(function () {
|
||||
$dtp.viewDate(currentViewDate);
|
||||
}, 50);
|
||||
});
|
||||
if ($(this).parent().is('.splitdatetimerow')) {
|
||||
$(this).on("dp.change", function (ev) {
|
||||
var $timepicker = $(this).closest(".splitdatetimerow").find(".timepickerfield");
|
||||
|
||||
@@ -82,7 +82,15 @@ var form_handlers = function (el) {
|
||||
Math.abs(+new Date(opts.minDate) - new Date()) < Math.abs(+new Date(opts.maxDate) - new Date())
|
||||
) ? opts.minDate : opts.maxDate;
|
||||
}
|
||||
$(this).datetimepicker(opts);
|
||||
$(this).datetimepicker(opts).on("dp.hide", function() {
|
||||
// when min/max is used in datetimepicker, closing and re-opening the picker opens at the wrong date
|
||||
// therefore keep the current viewDate and re-set it after datetimepicker is done hiding
|
||||
var $dtp = $(this).data("DateTimePicker");
|
||||
var currentViewDate = $dtp.viewDate();
|
||||
window.setTimeout(function () {
|
||||
$dtp.viewDate(currentViewDate);
|
||||
}, 50);
|
||||
});
|
||||
if ($(this).parent().is('.splitdatetimerow')) {
|
||||
$(this).on("dp.change", function (ev) {
|
||||
var $timepicker = $(this).closest(".splitdatetimerow").find(".timepickerfield");
|
||||
|
||||
Reference in New Issue
Block a user