Lines 6-11
var debug = "[% debug %]";
Link Here
|
6 |
var dformat = "[% dateformat %]"; |
6 |
var dformat = "[% dateformat %]"; |
7 |
var sentmsg = 0; |
7 |
var sentmsg = 0; |
8 |
if (debug > 1) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug + ")");} |
8 |
if (debug > 1) {alert("dateformat: " + dformat + "\ndebug is on (level " + debug + ")");} |
|
|
9 |
var MSG_PLEASE_ENTER_A_VALID_DATE = ("Please enter a valid date."); |
10 |
|
11 |
function validate_date (dateText, inst) { |
12 |
var dateformat = '[% Koha.Preference('dateformat') %]'; |
13 |
if ( dateformat == 'us' ) { |
14 |
dateformat = 'mm/dd/yy'; |
15 |
} else if ( dateformat == 'metric' ) { |
16 |
dateformat = 'dd/mm/yy'; |
17 |
} else if (dateformat == 'iso' ) { |
18 |
dateformat = 'yy-mm-dd'; |
19 |
} |
20 |
try { |
21 |
$.datepicker.parseDate(dateformat, dateText); |
22 |
} catch (e) { |
23 |
alert(MSG_PLEASE_ENTER_A_VALID_DATE); |
24 |
$('#'+inst.id).val(''); |
25 |
}; |
26 |
} |
9 |
|
27 |
|
10 |
function Date_from_syspref(dstring) { |
28 |
function Date_from_syspref(dstring) { |
11 |
var dateX = dstring.split(/[-/]/); |
29 |
var dateX = dstring.split(/[-/]/); |
Lines 87-93
$.datepicker.setDefaults({
Link Here
|
87 |
selectOtherMonths: true |
105 |
selectOtherMonths: true |
88 |
}); |
106 |
}); |
89 |
|
107 |
|
90 |
$( ".datepicker" ).datepicker(); |
108 |
$( ".datepicker" ).datepicker({ |
|
|
109 |
onClose: function(dateText, inst) { |
110 |
validate_date(dateText, inst); |
111 |
}, |
112 |
}); |
91 |
// http://jqueryui.com/demos/datepicker/#date-range |
113 |
// http://jqueryui.com/demos/datepicker/#date-range |
92 |
var dates = $( ".datepickerfrom, .datepickerto" ).datepicker({ |
114 |
var dates = $( ".datepickerfrom, .datepickerto" ).datepicker({ |
93 |
changeMonth: true, |
115 |
changeMonth: true, |
Lines 100-106
$.datepicker.setDefaults({
Link Here
|
100 |
$.datepicker._defaults.dateFormat, |
122 |
$.datepicker._defaults.dateFormat, |
101 |
selectedDate, instance.settings ); |
123 |
selectedDate, instance.settings ); |
102 |
dates.not( this ).datepicker( "option", option, date ); |
124 |
dates.not( this ).datepicker( "option", option, date ); |
103 |
} |
125 |
}, |
|
|
126 |
onClose: function(dateText, inst) { |
127 |
validate_date(dateText, inst); |
128 |
}, |
104 |
}); |
129 |
}); |
105 |
}); |
130 |
}); |
106 |
//]]> |
131 |
//]]> |