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

(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/calendar.inc (-6 / +13 lines)
Lines 70-84 Link Here
70
                    }
70
                    }
71
                });
71
                });
72
        },
72
        },
73
        onClose: function( selectedDates, dateText, instance) {
73
        onClose: function(selectedDates, dateText, instance) {
74
            validate_date( dateText, instance );
75
            var thisInput = instance.input;
74
            var thisInput = instance.input;
76
            if ( thisInput.hasAttribute('data-date_to') ) {
75
            const regex = new RegExp('^\d{4}$');
77
                var endPicker = document.querySelector("#"+thisInput.dataset.date_to)._flatpickr;
76
            if ( $(thisInput).data('flatpickr-allowyear') && regex.test(dateText) ) {
78
                endPicker.set('minDate', selectedDates[0]);
77
                console.log('Skipping validation');
78
            }
79
            else {
80
                validate_date( dateText, instance );
81
82
                if ( thisInput.hasAttribute('data-date_to') ) {
83
                    var endPicker = document.querySelector("#"+thisInput.dataset.date_to)._flatpickr;
84
                    endPicker.set('minDate', selectedDates[0]);
85
                }
79
            }
86
            }
80
87
81
            let = on_close_focus = $(thisInput).data('flatpickr-on-close-focus');
88
            var on_close_focus = $(thisInput).data('flatpickr-on-close-focus');
82
            if ( on_close_focus ) {
89
            if ( on_close_focus ) {
83
                $(on_close_focus).focus();
90
                $(on_close_focus).focus();
84
            }
91
            }
(-)a/koha-tmpl/intranet-tmpl/prog/js/datatables.js (-2 / +1 lines)
Lines 892-898 function _dt_add_filters(table_node, table_dt, filters_options = {}) { Link Here
892
                $(this).html( select );
892
                $(this).html( select );
893
            } else if (table_dt.settings()[0].aoColumns[i].sType == 'date' ) {
893
            } else if (table_dt.settings()[0].aoColumns[i].sType == 'date' ) {
894
                let existing_search = table_dt.column(i).search();
894
                let existing_search = table_dt.column(i).search();
895
                let input = $('<input type="text" class="flatpickr" style="width: 100%" />');
895
                let input = $('<input type="text" class="flatpickr" data-flatpickr-allowyear="true" style="width: 100%" />');
896
                if (existing_search) {
896
                if (existing_search) {
897
                    input.prop("value", existing_search);
897
                    input.prop("value", existing_search);
898
                }
898
                }
899
- 

Return to bug 34352