Lines 6-26
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."); |
9 |
var MSG_PLEASE_ENTER_A_VALID_DATE = _("Please enter a valid date (should match %s)."); |
10 |
|
10 |
|
11 |
function validate_date (dateText, inst) { |
11 |
function validate_date (dateText, inst) { |
12 |
var dateformat = '[% Koha.Preference('dateformat') %]'; |
12 |
var dateformat = '[% Koha.Preference('dateformat') %]'; |
|
|
13 |
var dateformat_str = dateformat |
13 |
if ( dateformat == 'us' ) { |
14 |
if ( dateformat == 'us' ) { |
14 |
dateformat = 'mm/dd/yy'; |
15 |
dateformat = 'mm/dd/yy'; |
|
|
16 |
dateformat_str = 'mm/dd/yyyy'; |
15 |
} else if ( dateformat == 'metric' ) { |
17 |
} else if ( dateformat == 'metric' ) { |
16 |
dateformat = 'dd/mm/yy'; |
18 |
dateformat = 'dd/mm/yy'; |
|
|
19 |
dateformat_str = 'dd/mm/yyyy'; |
17 |
} else if (dateformat == 'iso' ) { |
20 |
} else if (dateformat == 'iso' ) { |
18 |
dateformat = 'yy-mm-dd'; |
21 |
dateformat = 'yy-mm-dd'; |
|
|
22 |
dateformat_str = 'yyyy-mm-dd'; |
19 |
} |
23 |
} |
20 |
try { |
24 |
try { |
21 |
$.datepicker.parseDate(dateformat, dateText); |
25 |
$.datepicker.parseDate(dateformat, dateText); |
22 |
} catch (e) { |
26 |
} catch (e) { |
23 |
alert(MSG_PLEASE_ENTER_A_VALID_DATE); |
27 |
alert(MSG_PLEASE_ENTER_A_VALID_DATE.format(dateformat_str)); |
24 |
$('#'+inst.id).val(''); |
28 |
$('#'+inst.id).val(''); |
25 |
}; |
29 |
}; |
26 |
} |
30 |
} |
27 |
- |
|
|