From 43ae19b0d14c3cd8e64169769689efbc71c69587 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 --- koha-tmpl/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 0eb2c7f..185a51c 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.8.1