Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Limiting date filter year › Reply To: Limiting date filter year
August 26, 2025 at 2:03 pm
#55327
Keymaster
You are welcome!
I suspect it’s because on mobile it needs to be opened and the loading is delayed so the code does nothing. I think it’s still doable with a few changes:
add_action(
'wp_footer',
function () {
?>
<script>
window.addEventListener("load", () => {
const loadYears = ()=> {
setTimeout(function(){
$('.asp_w .hasDatepicker').datepicker('option', 'yearRange', '-9:+1')
}, 500);
};
document.querySelectorAll(".asp_main_container").forEach((el) => {
el.addEventListener("asp_settings_show", (event) => {
loadYears();
});
});
loadYears();
});
</script>
<?php
}
);