Lines 74-95
Link Here
|
74 |
var thisInput = instance.input; |
74 |
var thisInput = instance.input; |
75 |
if ( thisInput.hasAttribute('data-date_to') ) { |
75 |
if ( thisInput.hasAttribute('data-date_to') ) { |
76 |
var endPicker = document.querySelector("#"+thisInput.dataset.date_to)._flatpickr; |
76 |
var endPicker = document.querySelector("#"+thisInput.dataset.date_to)._flatpickr; |
|
|
77 |
if ( typeof endPicker === 'undefined' ) { |
78 |
console.log("Found non-existant picker"); |
79 |
endPicker = document.querySelector("#"+thisInput.dataset.date_to).flatpickr(); |
80 |
} |
77 |
endPicker.set('minDate', selectedDates[0]); |
81 |
endPicker.set('minDate', selectedDates[0]); |
78 |
} |
82 |
} |
79 |
}, |
83 |
}, |
80 |
}); |
84 |
}); |
81 |
$(document).ready(function(){ |
85 |
$(document).ready(function(){ |
82 |
$(".flatpickr").each(function(){ |
86 |
$(".flatpickr").each(function(){ |
83 |
let options = {}; |
87 |
|
|
|
88 |
var thisPicker; |
89 |
if ( $(this).get(0)._flatpickr ) { |
90 |
thisPicker = $(this).get(0)._flatpickr; |
91 |
} else { |
92 |
thisPicker = $(this).flatpickr(); |
93 |
} |
84 |
|
94 |
|
85 |
if( $(this).hasClass("futuredate") ) { |
95 |
if( $(this).hasClass("futuredate") ) { |
86 |
options['minDate'] = new Date().fp_incr(1); |
96 |
thisPicker.set('minDate', new Date().fp_incr(1)); |
87 |
options['allowInvalidPreload'] = true; |
97 |
thisPicker.set('allowInvalidPreload', true); |
88 |
} |
98 |
} |
89 |
if( $(this).hasClass("pastdate") ) { |
99 |
if( $(this).hasClass("pastdate") ) { |
90 |
options['maxDate'] = new Date().fp_incr(-1); |
100 |
thisPicker.set('maxDate', new Date().fp_incr(-1)); |
91 |
} |
101 |
} |
92 |
$(this).flatpickr(options); |
|
|
93 |
}); |
102 |
}); |
94 |
}); |
103 |
}); |
95 |
</script> |
104 |
</script> |
96 |
- |
|
|