Skip to content

Commit

Permalink
Clock Room Booking calendar validation added
Browse files Browse the repository at this point in the history
  • Loading branch information
akash70629 authored Oct 22, 2024
1 parent d53ba5e commit b12e449
Showing 1 changed file with 7 additions and 0 deletions.
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

0 comments on commit b12e449

Please sign in to comment.