[Koha-bugs] [Bug 30514] Error in date format check following datepicker removal

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Tue May 3 07:47:19 CEST 2022


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30514

--- Comment #6 from Jonathan Druart <jonathan.druart+koha at gmail.com> ---
What Katrin describes is not related to this bug report. It's very weird and I
have no idea where it's coming from.

I think there is still something wrong with this patch however. The
is_valid_date does not work as we are expecting. We used to have an alert if
the date was wrong.

The following change will restore the historical behaviour:

diff --git a/koha-tmpl/intranet-tmpl/prog/js/calendar.js
b/koha-tmpl/intranet-tmpl/prog/js/calendar.js
index 81561cc42d2..8ea4fbadfe6 100644
--- a/koha-tmpl/intranet-tmpl/prog/js/calendar.js
+++ b/koha-tmpl/intranet-tmpl/prog/js/calendar.js
@@ -22,12 +22,7 @@ function is_valid_date(date) {
         if (date.search(/^\d{2}\.\d{2}\.\d{4}($|\s)/) == -1) return 0;
         dateformat = 'd.m.Y';
     }
-    try {
-        flatpickr.parseDate(date, dateformat);
-    } catch (e) {
-        return 0;
-    }
-    return 1;
+    return flatpickr.parseDate(date, dateformat) ? 1 : 0;
 }

 function get_dateformat_str(dateformat) {

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list