Compare commits

...

7 Commits

Author SHA1 Message Date
Richard Schreiber
a290e96f74 add fix to pretix-control as well 2025-04-09 11:46:47 +02:00
Richard Schreiber
dca3ab8395 add comment as why dp.hide is needed 2025-04-09 11:46:38 +02:00
Richard Schreiber
8292ff0e2b undo unnecessary change in bootstrap-datetimepicker 2025-04-09 11:46:12 +02:00
Richard Schreiber
8c3880174e Fix daterange display with dp.hide and viewDate 2025-04-02 10:04:21 +02:00
Richard Schreiber
5a51a1105e Revert "add comment as to why to not clone date"
This reverts commit 10477785c3.
2025-04-02 10:03:01 +02:00
Richard Schreiber
10477785c3 add comment as to why to not clone date 2025-04-02 09:16:27 +02:00
Richard Schreiber
2819c66426 Fix datepicker date display when using min/max 2025-04-02 09:12:00 +02:00
2 changed files with 18 additions and 2 deletions

View File

@@ -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");

View File

@@ -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");