From 91659fa84863dc4f2a026450abdca8815f080e6c Mon Sep 17 00:00:00 2001 From: Linty Date: Mon, 19 Feb 2024 12:53:31 +0100 Subject: [PATCH] fixes #2117 add a condition to the date-end onChange function in the date-end OnChange event, before launching the function that will make the ajax request, we check that the `end` parameter is not "1899-12-31". --- admin/themes/default/js/history.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/admin/themes/default/js/history.js b/admin/themes/default/js/history.js index bd5e634ee..c52a10e1f 100644 --- a/admin/themes/default/js/history.js +++ b/admin/themes/default/js/history.js @@ -47,12 +47,16 @@ $(document).ready(() => { }); $('.date-end').on("change", function () { - console.log($('.date-end input[name="end"]').attr("value")); - if (current_param.end != $('.date-end input[name="end"]').attr("value")) { - console.log("HERE"); + const newValue = $('.date-end input[name="end"]').attr("value"); + if (current_param.end != newValue) { current_param.end = $('.date-end input[name="end"]').attr("value"); current_param.pageNumber = 0; - fillHistoryResult(current_param); + // The datepicker first fills the end-date with '1899-12-31', + // which triggers an unnecessary ajax request + // when you come to the history search page from a photo. + if (newValue !== '1899-12-31') { + fillHistoryResult(current_param); + } } });