Bug 20568: Fix bad resolution conflict with bug 18403
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / includes / calendar.inc
index 7175df2..f13a1fa 100644 (file)
@@ -6,7 +6,7 @@ var debug    = "[% debug %]";
 var dformat  = "[% dateformat %]";
 var sentmsg = 0;
 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).");
+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.
@@ -14,16 +14,16 @@ function is_valid_date(date) {
 
     var dateformat = dateformat_str = '[% Koha.Preference('dateformat') %]';
     if ( dateformat == 'us' ) {
-        if ( date.search(/\d{2}\/\d{2}\/\d{4}/) == -1 ) return 0;
+        if ( date.search(/^\d{2}\/\d{2}\/\d{4}($|\s)/) == -1 ) return 0;
         dateformat = 'mm/dd/yy';
     } else if ( dateformat == 'metric' ) {
-        if ( date.search(/\d{2}\/\d{2}\/\d{4}/) == -1 ) return 0;
+        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}/) == -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}/) == -1 ) return 0;
+        if ( date.search(/^\d{2}\.\d{2}\.\d{4}($|\s)/) == -1 ) return 0;
         dateformat = 'dd.mm.yy';
     }
     try {
@@ -135,7 +135,12 @@ $.datepicker.setDefaults({
         buttonImageOnly: true,
         showButtonPanel: true,
         showOtherMonths: true,
-        selectOtherMonths: true
+        selectOtherMonths: true,
+        yearRange: "c-100:c+10"
+    });
+
+$("#dateofbirth").datepicker({
+        yearRange: "c-100:c"
     });
 
     $( ".datepicker" ).datepicker({