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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc (-8 / +12 lines)
Lines 31-42 Link Here
31
        },
31
        },
32
        onReady: function( selectedDates, dateStr, instance ){
32
        onReady: function( selectedDates, dateStr, instance ){
33
            /* When flatpickr instance is created, automatically append a "clear date" link */
33
            /* When flatpickr instance is created, automatically append a "clear date" link */
34
            if( $(instance.input).hasClass("futuredate") ){
35
                instance.set("minDate", new Date().fp_incr(1));
36
            }
37
            if( $(instance.input).hasClass("pastdate") ){
38
                instance.set("maxDate", new Date().fp_incr(-1));
39
            }
40
            $(instance.input)
34
            $(instance.input)
41
                /* Add a wrapper element so that we can prevent the clear button from wrapping */
35
                /* Add a wrapper element so that we can prevent the clear button from wrapping */
42
                .wrap("<span class='flatpickr_wrapper'></span>")
36
                .wrap("<span class='flatpickr_wrapper'></span>")
Lines 62-68 Link Here
62
        },
56
        },
63
    });
57
    });
64
    $(document).ready(function(){
58
    $(document).ready(function(){
65
        $(".flatpickr").flatpickr();
59
        $(".flatpickr").each(function(){
60
            let options = {};
61
62
            if( $(this).hasClass("futuredate") ) {
63
                options['minDate'] = new Date().fp_incr(1);
64
                options['allowInvalidPreload'] = true;
65
            }
66
            if( $(this).hasClass("pastdate") ) {
67
                options['maxDate'] = new Date().fp_incr(-1);
68
            }
69
            $(this).flatpickr(options);
70
        });
66
        var startPicker = $(".flatpickrfrom").flatpickr({
71
        var startPicker = $(".flatpickrfrom").flatpickr({
67
            onClose: function( selectedDates, dateText, instance) {
72
            onClose: function( selectedDates, dateText, instance) {
68
                validate_date( selectedDates, instance );
73
                validate_date( selectedDates, instance );
69
- 

Return to bug 29241