[Koha-bugs] [Bug 33132] Searching by DOB still broken in 22.05.x

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Jul 7 10:10:14 CEST 2023


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

--- Comment #7 from Jonathan Druart <jonathan.druart+koha at gmail.com> ---
(In reply to Marcel de Rooy from comment #6)
> Applies to 22.05.x. Not tested.
> 
> koha-tmpl/intranet-tmpl/prog/en/includes/js-date-format.inc:       
> window.$date_to_rfc3339 = function(value, options) {
> koha-tmpl/intranet-tmpl/prog/en/includes/patron-search.inc:                 
> let d = $date_to_rfc3339(pattern);
> 
>         window.$date_to_rfc3339 = function(value, options) {
>             var dateformat = (options&&options.dateformat)||def_date_format;
>             let m = moment(value, get_date_pattern(dateformat));
>             return m.format("YYYY-MM-DD");
>         }
> 
> Just some observations, not blocking:
> Why do you have options if you do not use them?

This function has a bad and wrong history. This version is the one in master.
options is there because it was there before, and it is consistent with the
other function in the same file.

> Why do you call get_date_pattern if you format YMD later on?
> Looks good to me for the rest.

You need to tell moment in which format is the string you are passing it.

What we are doing is:
let m = moment("20/06/2023", "DD/MM/YYYY"); // DD/MM/YYYY (indirectly) coming
from dateformat
m is a moment object
you want to dispay the rfc3339/ymd version, and you ask moment to format it
like that:
m.format("YYYY-MM-DD")

Does that make sense now?

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


More information about the Koha-bugs mailing list