|
Lines 31-39
function is_valid_date(date) {
Link Here
|
| 31 |
return 1; |
31 |
return 1; |
| 32 |
} |
32 |
} |
| 33 |
|
33 |
|
|
|
34 |
function get_dateformat_str(dateformat) { |
| 35 |
var dateformat_str; |
| 36 |
if ( dateformat == 'us' ) { |
| 37 |
dateformat_str = 'mm/dd/yyyy'; |
| 38 |
} else if ( dateformat == 'metric' ) { |
| 39 |
dateformat_str = 'dd/mm/yyyy'; |
| 40 |
} else if (dateformat == 'iso' ) { |
| 41 |
dateformat_str = 'yyyy-mm-dd'; |
| 42 |
} else if ( dateformat == 'dmydot' ) { |
| 43 |
dateformat_str = 'dd.mm.yyyy'; |
| 44 |
} |
| 45 |
return dateformat_str; |
| 46 |
} |
| 47 |
|
| 34 |
function validate_date (dateText, inst) { |
48 |
function validate_date (dateText, inst) { |
| 35 |
if ( !is_valid_date(dateText) ) { |
49 |
if ( !is_valid_date(dateText) ) { |
| 36 |
var dateformat_str = '[% Koha.Preference('dateformat') %]'; |
50 |
var dateformat_str = get_dateformat_str( '[% Koha.Preference('dateformat') %]' ); |
| 37 |
alert(MSG_PLEASE_ENTER_A_VALID_DATE.format(dateformat_str)); |
51 |
alert(MSG_PLEASE_ENTER_A_VALID_DATE.format(dateformat_str)); |
| 38 |
$('#'+inst.id).val(''); |
52 |
$('#'+inst.id).val(''); |
| 39 |
} |
53 |
} |
| 40 |
- |
|
|