
How to prevent selection of weekends in date picker?
We can provide no weekend function into the date picker option. Please follow next steps:
1. Use next Custom CSS and add them to Customizer > Additional CSS field:
.ui-datepicker-week-end { display: none !important; }
2. Also, make sure to add next JS into Custom JS field in Customizer > General Settings:
const picker = document.getElementById('date'); picker.addEventListener('input', function(e){ var day = new Date(this.value).getUTCDay(); if([6,0].includes(day)){ e.preventDefault(); this.value = ''; alert('Weekends not allowed'); } });
3. Than edit line 444 in bt_cost_calculator.php file, located in \wp-content\plugins\bt_cost_calculator folder on your site :
$output .= '<div class="btQuoteItem' . $m_date . '"><input type="text" class="btContactDate btContactField" placeholder="' . $date_text . '"></div>';
replace with next line:
$output .= '<div class="btQuoteItem' . $m_date . '"><input type="text" class="btContactDate btContactField" id="date" placeholder="' . $date_text . '"></div>';