From 0e28efe9ee7b16b05624ffaf90fc3c4e53ab7f36 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 31 Oct 2016 14:40:51 +0000 Subject: [PATCH] Bug 17524: Fix datepicker check for iso dates MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Iso dates are yyyy-mm-dd, the is_valid JS function expects \d{2}-\d{2}-\d{4} when it should be \d{4}-\d{2}-\d{2} Test plan: Switch DateFormat to iso Set a due date using the datepicker => Should work as expected Signed-off-by: Mark Tompsett Signed-off-by: Nick Clemens Signed-off-by: Kyle M Hall (cherry picked from commit 23f4830095d64d9a421a458fe5582930aa229aa7) Signed-off-by: Frédéric Demians --- koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc index aba713e9cd..f6d9e9b66f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc @@ -20,7 +20,7 @@ function is_valid_date(date) { if ( date.search(/^\d{2}\/\d{2}\/\d{4}($|\s)/) == -1 ) return 0; dateformat = 'dd/mm/yy'; } else if (dateformat == 'iso' ) { - if ( date.search(/^\d{2}-\d{2}-\d{4}($|\s)/) == -1 ) return 0; + if ( date.search(/^\d{4}-\d{2}-\d{2}($|\s)/) == -1 ) return 0; dateformat = 'yy-mm-dd'; } else if ( dateformat == 'dmydot' ) { if ( date.search(/^\d{2}\.\d{2}\.\d{4}($|\s)/) == -1 ) return 0; -- 2.39.5