From a00bb70c9848179d41945a91f020ed39d8468186 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Wed, 9 Jun 2021 17:59:59 +0000 Subject: [PATCH] Bug 28538: Insert formatted date if valid This patch restores the setting of the date from bug 27937 and adds a parsing of the date to ensure the correct format To test: 1 - Follow test plan from bug 27937 - it fails 2 - Follow test plan from bug 28351 - it succeeds 3 - Apply patch 4 - Repeat 1-2 5 - both plans pass now Signed-off-by: Andrew Fuerste-Henry Signed-off-by: Tomas Cohen Arazi Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall (cherry picked from commit c43047968c31a918923aa4ef89fd56be2fcf54ec) Signed-off-by: Fridolin Somers --- .../intranet-tmpl/prog/en/includes/borrower_debarments.inc | 2 +- koha-tmpl/intranet-tmpl/prog/js/calendar.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc index 511a6b88a5..fb90add482 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/borrower_debarments.inc @@ -60,7 +60,7 @@ Add manual restriction
  1. -
  2. +
  3. Clear date
Cancel
diff --git a/koha-tmpl/intranet-tmpl/prog/js/calendar.js b/koha-tmpl/intranet-tmpl/prog/js/calendar.js index 1f312e813d..3ed43219f8 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/calendar.js +++ b/koha-tmpl/intranet-tmpl/prog/js/calendar.js @@ -192,6 +192,9 @@ $(document).ready(function () { }).on("change", function () { if (!is_valid_date($(this).val())) { $(this).val(""); + } else { + var the_date = $.datepicker.parseDate(dateformat_string, $(this).val()); + $(this).datepicker("setDate",the_date); } }); // http://jqueryui.com/demos/datepicker/#date-range -- 2.39.5