Student Registration

  • Home
  • Student Registration
cript> document.addEventListener('DOMContentLoaded', function() { const dateInput = document.getElementById('booking-date'); if (dateInput) { const today = new Date(); // Add 2 days (skip today and tomorrow) const minDate = new Date(today); minDate.setDate(today.getDate() + 2); // Format as YYYY-MM-DD const year = minDate.getFullYear(); const month = String(minDate.getMonth() + 1).padStart(2, '0'); const day = String(minDate.getDate()).padStart(2, '0'); dateInput.min = `${year}-${month}-${day}`; dateInput.value = `${year}-${month}-${day}`; // Validation on change dateInput.addEventListener('change', function() { const selectedDate = new Date(this.value); const today = new Date(); const minAllowedDate = new Date(today); minAllowedDate.setDate(today.getDate() + 2); minAllowedDate.setHours(0, 0, 0, 0); if (selectedDate < minAllowedDate) { alert('Please select a date that is at least 2 days from today (day after tomorrow or later).'); const year = minAllowedDate.getFullYear(); const month = String(minAllowedDate.getMonth() + 1).padStart(2, '0'); const day = String(minAllowedDate.getDate()).padStart(2, '0'); this.value = `${year}-${month}-${day}`; } }); } });