Lines 157-184
Link Here
|
157 |
} |
157 |
} |
158 |
} |
158 |
} |
159 |
|
159 |
|
160 |
function Date_from_syspref(dstring) { |
|
|
161 |
var dateX = dstring.split(/[-/.]/); |
162 |
if (debug > 1 && sentmsg < 1) { |
163 |
sentmsg++; |
164 |
alert("Date_from_syspref(" + dstring + ") splits to:\n" + dateX.join("\n")); |
165 |
} |
166 |
if (dateformat_pref === "iso") { |
167 |
return new Date(dateX[0], (dateX[1] - 1), dateX[2]); // YYYY-MM-DD to (YYYY,m(0-11),d) |
168 |
} else if (dateformat_pref === "us") { |
169 |
return new Date(dateX[2], (dateX[0] - 1), dateX[1]); // MM/DD/YYYY to (YYYY,m(0-11),d) |
170 |
} else if (dateformat_pref === "metric") { |
171 |
return new Date(dateX[2], (dateX[1] - 1), dateX[0]); // DD/MM/YYYY to (YYYY,m(0-11),d) |
172 |
} else if (dateformat_pref === "dmydot") { |
173 |
return new Date(dateX[2], (dateX[1] - 1), dateX[0]); // DD.MM.YYYY to (YYYY,m(0-11),d) |
174 |
} else { |
175 |
if (debug > 0) { |
176 |
alert("KOHA ERROR - Unrecognized date format: " + dateformat_pref); |
177 |
} |
178 |
return 0; |
179 |
} |
180 |
} |
181 |
|
182 |
$(document).ready(function(){ |
160 |
$(document).ready(function(){ |
183 |
$(".flatpickr").each(function(){ |
161 |
$(".flatpickr").each(function(){ |
184 |
let options = {}; |
162 |
let options = {}; |
Lines 189-195
Link Here
|
189 |
|| $(this).data("flatpickr-futuredate") === true ) { |
167 |
|| $(this).data("flatpickr-futuredate") === true ) { |
190 |
let original_date = $(this).val(); |
168 |
let original_date = $(this).val(); |
191 |
if ( original_date ) { |
169 |
if ( original_date ) { |
192 |
original_date = Date_from_syspref( original_date ).getTime(); |
170 |
original_date = flatpickr.parseDate(original_date, 'Y-m-d').getTime(); |
193 |
let tomorrow = new Date().fp_incr(1).getTime(); |
171 |
let tomorrow = new Date().fp_incr(1).getTime(); |
194 |
|
172 |
|
195 |
options['enable'] = [function(date){ |
173 |
options['enable'] = [function(date){ |