Bug 14060: Consider an empty string as a valid date
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 5 Sep 2016 08:16:02 +0000 (09:16 +0100)
committerKyle M Hall <kyle@bywatersolutions.com>
Thu, 8 Sep 2016 12:04:21 +0000 (12:04 +0000)
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc

index 14ec21d..7175df2 100644 (file)
@@ -9,6 +9,9 @@ if (debug > 1) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug
 var MSG_PLEASE_ENTER_A_VALID_DATE = _("Please enter a valid date (should match %s).");
 
 function is_valid_date(date) {
+    // An empty string is considered as a valid date for convenient reasons.
+    if ( date === '' ) return 1;
+
     var dateformat = dateformat_str = '[% Koha.Preference('dateformat') %]';
     if ( dateformat == 'us' ) {
         if ( date.search(/\d{2}\/\d{2}\/\d{4}/) == -1 ) return 0;