View | Details | Raw Unified | Return to bug 14060
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc (-5 / +4 lines)
Lines 14-29 function is_valid_date(date) { Link Here
14
14
15
    var dateformat = dateformat_str = '[% Koha.Preference('dateformat') %]';
15
    var dateformat = dateformat_str = '[% Koha.Preference('dateformat') %]';
16
    if ( dateformat == 'us' ) {
16
    if ( dateformat == 'us' ) {
17
        if ( date.search(/\d{2}\/\d{2}\/\d{4}/) == -1 ) return 0;
17
        if ( date.search(/^\d{2}\/\d{2}\/\d{4}($|\s)/) == -1 ) return 0;
18
        dateformat = 'mm/dd/yy';
18
        dateformat = 'mm/dd/yy';
19
    } else if ( dateformat == 'metric' ) {
19
    } else if ( dateformat == 'metric' ) {
20
        if ( date.search(/\d{2}\/\d{2}\/\d{4}/) == -1 ) return 0;
20
        if ( date.search(/^\d{2}\/\d{2}\/\d{4}($|\s)/) == -1 ) return 0;
21
        dateformat = 'dd/mm/yy';
21
        dateformat = 'dd/mm/yy';
22
    } else if (dateformat == 'iso' ) {
22
    } else if (dateformat == 'iso' ) {
23
        if ( date.search(/\d{2}-\d{2}-\d{4}/) == -1 ) return 0;
23
        if ( date.search(/^\d{2}-\d{2}-\d{4}($|\s)/) == -1 ) return 0;
24
        dateformat = 'yy-mm-dd';
24
        dateformat = 'yy-mm-dd';
25
    } else if ( dateformat == 'dmydot' ) {
25
    } else if ( dateformat == 'dmydot' ) {
26
        if ( date.search(/\d{2}\.\d{2}\.\d{4}/) == -1 ) return 0;
26
        if ( date.search(/^\d{2}\.\d{2}\.\d{4}($|\s)/) == -1 ) return 0;
27
        dateformat = 'dd.mm.yy';
27
        dateformat = 'dd.mm.yy';
28
    }
28
    }
29
    try {
29
    try {
30
- 

Return to bug 14060