|
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 67-73
Link Here
|
| 67 |
}, |
61 |
}, |
| 68 |
}); |
62 |
}); |
| 69 |
$(document).ready(function(){ |
63 |
$(document).ready(function(){ |
| 70 |
$(".flatpickr").flatpickr(); |
64 |
$(".flatpickr").each(function(){ |
|
|
65 |
let options = {}; |
| 66 |
|
| 67 |
if( $(this).hasClass("futuredate") ) { |
| 68 |
options['minDate'] = new Date().fp_incr(1); |
| 69 |
options['allowInvalidPreload'] = true; |
| 70 |
} |
| 71 |
if( $(this).hasClass("pastdate") ) { |
| 72 |
options['maxDate'] = new Date().fp_incr(-1); |
| 73 |
} |
| 74 |
$(this).flatpickr(options); |
| 75 |
}); |
| 71 |
}); |
76 |
}); |
| 72 |
</script> |
77 |
</script> |
| 73 |
[% END %] |
78 |
[% END %] |
| 74 |
- |
|
|