Contact form: set min date to today on event date picker

This commit is contained in:
chris 2026-06-07 00:35:32 -04:00
parent 77318fb477
commit 0d57760df1

View File

@ -10,8 +10,15 @@
const submitBtn = document.getElementById('submitBtn'); const submitBtn = document.getElementById('submitBtn');
const textarea = form.querySelector('textarea[name="message"]'); const textarea = form.querySelector('textarea[name="message"]');
const phoneInput = form.querySelector('input[name="phone"]'); const phoneInput = form.querySelector('input[name="phone"]');
const dateInput = form.querySelector('input[name="eventDate"]');
let selectedFiles = []; let selectedFiles = [];
// Forbid past dates (today is allowed)
if (dateInput) {
const t = new Date();
dateInput.min = `${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,'0')}-${String(t.getDate()).padStart(2,'0')}`;
}
// Textarea auto-resize // Textarea auto-resize
textarea.style.overflow = 'hidden'; textarea.style.overflow = 'hidden';
textarea.addEventListener('input', function () { textarea.addEventListener('input', function () {