Lines 56-74
function validate_date (dateText, inst) {
Link Here
|
56 |
} |
56 |
} |
57 |
} |
57 |
} |
58 |
|
58 |
|
59 |
function Date_from_syspref(dstring) { |
59 |
function Date_from_syspref(dstring, tmpdformat) { |
60 |
var dateX = dstring.split(/[-/.]/); |
60 |
var dateX = dstring.split(/[-/.]/); |
|
|
61 |
if (typeof tmpdformat === 'undefined') { |
62 |
tmpdformat = dformat; |
63 |
} |
61 |
if (debug > 1 && sentmsg < 1) {sentmsg++; alert("Date_from_syspref(" + dstring + ") splits to:\n" + dateX.join("\n"));} |
64 |
if (debug > 1 && sentmsg < 1) {sentmsg++; alert("Date_from_syspref(" + dstring + ") splits to:\n" + dateX.join("\n"));} |
62 |
if (dformat === "iso") { |
65 |
if (tmpdformat === "iso") { |
63 |
return new Date(dateX[0], (dateX[1] - 1), dateX[2]); // YYYY-MM-DD to (YYYY,m(0-11),d) |
66 |
return new Date(dateX[0], (dateX[1] - 1), dateX[2]); // YYYY-MM-DD to (YYYY,m(0-11),d) |
64 |
} else if (dformat === "us") { |
67 |
} else if (tmpdformat === "us") { |
65 |
return new Date(dateX[2], (dateX[0] - 1), dateX[1]); // MM/DD/YYYY to (YYYY,m(0-11),d) |
68 |
return new Date(dateX[2], (dateX[0] - 1), dateX[1]); // MM/DD/YYYY to (YYYY,m(0-11),d) |
66 |
} else if (dformat === "metric") { |
69 |
} else if (tmpdformat === "metric") { |
67 |
return new Date(dateX[2], (dateX[1] - 1), dateX[0]); // DD/MM/YYYY to (YYYY,m(0-11),d) |
70 |
return new Date(dateX[2], (dateX[1] - 1), dateX[0]); // DD/MM/YYYY to (YYYY,m(0-11),d) |
68 |
} else if (dformat === "dmydot") { |
71 |
} else if (tmpdformat === "dmydot") { |
69 |
return new Date(dateX[2], (dateX[1] - 1), dateX[0]); // DD.MM.YYYY to (YYYY,m(0-11),d) |
72 |
return new Date(dateX[2], (dateX[1] - 1), dateX[0]); // DD.MM.YYYY to (YYYY,m(0-11),d) |
70 |
} else { |
73 |
} else { |
71 |
if (debug > 0) {alert("KOHA ERROR - Unrecognized date format: " +dformat);} |
74 |
if (debug > 0) {alert("KOHA ERROR - Unrecognized date format: " +tmpdformat);} |
72 |
return 0; |
75 |
return 0; |
73 |
} |
76 |
} |
74 |
} |
77 |
} |
Lines 150-155
$("#dateofbirth").datepicker({
Link Here
|
150 |
}).on("change", function(e, value) { |
153 |
}).on("change", function(e, value) { |
151 |
if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");} |
154 |
if ( ! is_valid_date( $(this).val() ) ) {$(this).val("");} |
152 |
}); |
155 |
}); |
|
|
156 |
|
157 |
$( ".datepicker" ).each(function () { |
158 |
var defval = $(this).data("defvalue"); |
159 |
if (defval !== "") { |
160 |
var tmpd = Date_from_syspref(defval, "iso"); |
161 |
$(this).datepicker('setDate', tmpd); |
162 |
} |
163 |
}); |
164 |
|
153 |
// http://jqueryui.com/demos/datepicker/#date-range |
165 |
// http://jqueryui.com/demos/datepicker/#date-range |
154 |
var dates = $( ".datepickerfrom, .datepickerto" ).datepicker({ |
166 |
var dates = $( ".datepickerfrom, .datepickerto" ).datepicker({ |
155 |
changeMonth: true, |
167 |
changeMonth: true, |