Browse Source

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 <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.11/bug30761
Jonathan Druart 2 years ago
parent
commit
a91325387b
  1. 11
      koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc

11
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);
}
});
});

Loading…
Cancel
Save