Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🛠️Fix : Calendar Date Validation: Allows Selection of Past Dates #397

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions frontend/src/Pages/booking.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,11 @@ const BookingPage = () => {
// Render booking form for selected service

const renderBookingForm = () => {

// Calender validation code start
const [minDate, setMinDate] = useState(new Date().toISOString().split('T')[0]);
// Calender validation code end

if (!selectedService) return null;

if (selectedService === "cloak") {
Expand All @@ -211,6 +216,7 @@ const BookingPage = () => {
<DatePicker
selected={formData.startDate}
onChange={(date) => setFormData({ ...formData, startDate: date })}
minDate={minDate} // Setting minimum date to today
className="w-full px-4 py-2 mt-2 transition duration-200 border border-blue-300 rounded-lg focus:ring-2 focus:ring-blue-400"
/>
</label>
Expand All @@ -219,6 +225,7 @@ const BookingPage = () => {
<DatePicker
selected={formData.endDate}
onChange={(date) => setFormData({ ...formData, endDate: date })}
minDate={minDate} // Setting minimum date to today
className="w-full px-4 py-2 mt-2 transition duration-200 border border-blue-300 rounded-lg focus:ring-2 focus:ring-blue-400"
/>
</label>
Expand Down
Loading