From a91325387bbdeca474bdfea0c8d7afba5aaa3ccd Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 19 Nov 2021 10:55:47 +0100 Subject: [PATCH] Bug 29478: (follow-up) Today should select now for pastinclusive This is getting ugly. We need to add 1 minute for the minDate or the 'Today' link may not work. Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Jonathan Druart --- koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc index 11c8ee4e50..2805870d10 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc @@ -159,8 +159,15 @@ let fp = $(this).flatpickr(options); if ( refresh_max_date ) { /* Refresh the maxDate every 30 secondes to make sure the user will not - be stuck with the minute passed */ - setInterval(() => { fp.set("maxDate", new Date()) }, 30000); + be stuck with the minute passed. + Adding 1 minute to not introduce a gap. + Example: last update at 40s, a new minute passed at 00. + Between 00 and 10s the user won't be able click 'Today'. + */ + setInterval(() => { + let now = new Date(); + fp.set("maxDate", now.setMinutes(now.getMinutes() + 1)); + }, 30000); } }); }); -- 2.39.5