From 26fdc96c5ea824b5529da846b63a8e4e62d486e8 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 26 Aug 2016 08:44:06 +0100 Subject: [PATCH] Bug 14060: Display date format pattern instead of date format name Signed-off-by: Owen Leonard Signed-off-by: Nick Clemens Signed-off-by: Kyle M Hall --- .../intranet-tmpl/prog/en/includes/calendar.inc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 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 0eb2c7f9f5..185a51c98a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc @@ -31,9 +31,23 @@ function is_valid_date(date) { return 1; } +function get_dateformat_str(dateformat) { + var dateformat_str; + if ( dateformat == 'us' ) { + dateformat_str = 'mm/dd/yyyy'; + } else if ( dateformat == 'metric' ) { + dateformat_str = 'dd/mm/yyyy'; + } else if (dateformat == 'iso' ) { + dateformat_str = 'yyyy-mm-dd'; + } else if ( dateformat == 'dmydot' ) { + dateformat_str = 'dd.mm.yyyy'; + } + return dateformat_str; +} + function validate_date (dateText, inst) { if ( !is_valid_date(dateText) ) { - var dateformat_str = '[% Koha.Preference('dateformat') %]'; + var dateformat_str = get_dateformat_str( '[% Koha.Preference('dateformat') %]' ); alert(MSG_PLEASE_ENTER_A_VALID_DATE.format(dateformat_str)); $('#'+inst.id).val(''); } -- 2.39.5