From fcfceee537bbd43c19c5a653a7c7e76c948d45d8 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 4 Sep 2024 14:20:33 +0200 Subject: [PATCH] Bug 37905: Use the server's tz to limit the jobs by "enqueued in the last hour" This patch suggests to revert the previous attempt to fix this problem. The date was using the client-side's tz and so the "last hour" was not matching the one from the server. I have noticed a couple of things when working on this: * We cannot pass a RFC3339 formatted date to the server (will open a separate bug report) * toISOString() and the handling of timezone in dayjs is ambiguous or buggy https://github.com/iamkun/dayjs/issues/2720 https://github.com/iamkun/dayjs/issues/2611 With bug 37831 with simply need to pass a rfc3339-formatted date and the filtering will be done as expected. --- .../intranet-tmpl/prog/en/modules/admin/background_jobs.tt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt index fb92ebd0e1e..ca4989c717f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/background_jobs.tt @@ -264,9 +264,11 @@ let now = new Date(); if ( $("#include_last_hour").is(":checked") ) { now.setHours(now.getHours() - 1); - return { ">": now.toISOString() }; + let now_with_server_tz = $datetime(now.toISOString(), { dateformat: 'rfc3339' }); + return { ">": now_with_server_tz }; } else { - return { "<": now.toISOString() }; + let now_with_server_tz = $datetime(now.toISOString(), { dateformat: 'rfc3339' }); + return { "<": now_with_server_tz }; } } }; -- 2.34.1