Lines 11-27
var MSG_PLEASE_ENTER_A_VALID_DATE = _("Please enter a valid date (should match %
Link Here
|
11 |
function is_valid_date(date) { |
11 |
function is_valid_date(date) { |
12 |
var dateformat = dateformat_str = '[% Koha.Preference('dateformat') %]'; |
12 |
var dateformat = dateformat_str = '[% Koha.Preference('dateformat') %]'; |
13 |
if ( dateformat == 'us' ) { |
13 |
if ( dateformat == 'us' ) { |
|
|
14 |
if ( date.search(/\d{2}\/\d{2}\/\d{4}/) == -1 ) return 0; |
14 |
dateformat = 'mm/dd/yy'; |
15 |
dateformat = 'mm/dd/yy'; |
15 |
dateformat_str = 'mm/dd/yyyy'; |
|
|
16 |
} else if ( dateformat == 'metric' ) { |
16 |
} else if ( dateformat == 'metric' ) { |
|
|
17 |
if ( date.search(/\d{2}\/\d{2}\/\d{4}/) == -1 ) return 0; |
17 |
dateformat = 'dd/mm/yy'; |
18 |
dateformat = 'dd/mm/yy'; |
18 |
dateformat_str = 'dd/mm/yyyy'; |
|
|
19 |
} else if (dateformat == 'iso' ) { |
19 |
} else if (dateformat == 'iso' ) { |
|
|
20 |
if ( date.search(/\d{2}-\d{2}-\d{4}/) == -1 ) return 0; |
20 |
dateformat = 'yy-mm-dd'; |
21 |
dateformat = 'yy-mm-dd'; |
21 |
dateformat_str = 'yyyy-mm-dd'; |
|
|
22 |
} else if ( dateformat == 'dmydot' ) { |
22 |
} else if ( dateformat == 'dmydot' ) { |
|
|
23 |
if ( date.search(/\d{2}\.\d{2}\.\d{4}/) == -1 ) return 0; |
23 |
dateformat = 'dd.mm.yy'; |
24 |
dateformat = 'dd.mm.yy'; |
24 |
dateformat_str = 'dd.mm.yyyy'; |
|
|
25 |
} |
25 |
} |
26 |
try { |
26 |
try { |
27 |
$.datepicker.parseDate(dateformat, date); |
27 |
$.datepicker.parseDate(dateformat, date); |
28 |
- |
|
|