cornellh4i / lagos-volunteers

Lagos Food Bank Volunteer Management System
https://lagos-volunteers.vercel.app
MIT License
13 stars 6 forks source link

Prevent event creation in the past #247

Closed jasozh closed 4 months ago

jasozh commented 6 months ago

Summary

Fixes a current bug where supervisors can create events that are in the past if they happen on the same day if they select a time that is earlier than now (e.g. if today is 4/13 5:00 pm, supervisors can still create an even that happens on 4/13 from 8:00 am to 9:00 am). Solution: make the minimum event date tomorrow (also means we don't need to do more cumbersome date validation).

Testing

Notes

vercel[bot] commented 6 months ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
lagos-volunteers ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2024 1:11am
akinfelami commented 6 months ago

Doesn't this mean that they wouldn't be able to create events on the same day? There is an alternative prop that we can pass into the timepicker that will prevent times before the current time. See here

akinfelami commented 5 months ago

Doesn't this mean that they wouldn't be able to create events on the same day? There is an alternative prop that we can pass into the timepicker that will prevent times before the current time. See here

Actually just noticed that disablePast was the prop that was removed

akinfelami commented 5 months ago

I pushed a commit that:

jasozh commented 4 months ago

Finally implemented proper solution which is just to create a new timeAndDateValidation() function that checks to see (before submission) if the input date is before the current datetime.