From c7d5192add6bdd1eb50fde4ed74b35ce2d8525ed Mon Sep 17 00:00:00 2001 From: Ville Korjus Date: Tue, 25 Apr 2023 13:00:24 +0300 Subject: [PATCH] Bug 36217: Fix background jobs page's include_last_hour filter Test plan: 1) Create a background job 2) Go to the background jobs page 3) See your job listed 4) Unselect "include_last_hour" from the filter 5) Verify that the job is not listed 6) Apply the patch 7) Repeat steps 1-3 8) Verify that the job is now listed --- .../prog/en/modules/admin/background_jobs.tt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 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 e23f04ba41..01b023c0df 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 @@ -262,11 +262,14 @@ let additional_filters = { enqueued_on: function(){ let now = new Date(); + var tzoffset = (new Date()).getTimezoneOffset() * 60000; + if ( $("#only_current").is(":checked") && !$("#include_last_hour").is(":checked")) { + return 0; + } if ( $("#include_last_hour").is(":checked") ) { - now.setHours(now.getHours() - 1); - return { ">": now.toISOString() }; + return { ">": (new Date(now.setHours(now.getHours() - 1) - tzoffset)).toISOString().slice(0, -1) }; } else { - return { "<": now.toISOString() }; + return { "<": (new Date(Date.now() - tzoffset)).toISOString().slice(0, -1) }; } } }; -- 2.34.1