date and time picker, that can take a max and min absolute time, compatible with react [on hold]
Web Technologies
Web Development
2 years ago
5
Star Rating
1
Rating
_x000D_
_x000D_
I have an issue with scheduling things in a web platform (react.js), and need a date+time picker that can solve following case:
A event may have a start date+time and may have a specified end date+time. may, not must.
both start and end must not be before right now. start may not be after end if end is set already. End must not be before start if start is set already.
pseudo:
Start date+time must not be < now && !> end (if end is defined)
end date+time must not be < now && !< start (if start is defined)
Therefore I need to be able to pass in some date+time absolute min + max constraint, while being able to leave both or one of the inputs undefined. This rules our most range selectors, example: http://projects.wojtekmaj.pl/react-datetimerange-picker/ this one will not allow start time to be after end time, or vice versa, but it does also not allow either start or end to be empty.
I have found many date time pickers that can take some sort of isDateValid function, but most of them have date and time separated which makes absolute constraining difficult.
Here is an example of how I tricked react-datetime to break my time constraints
I set start date 01-01-2020 18:00
Now I can only set end date to the same or later.
I can set end to 01-01-2020 18:00
I can not set it so 01-01-2020 07:00.
I can set it to 01-02-2020 07:00.
And because date and time is not the same thing, I can now still set the date back to 01-01-2020 while the time is still 07:00, creating a
illegal state where end time is before start time.
Obviously some fancy custom logic can solve this, but I was wondering if there are any opensource date+time pickers out there that can take a maximum and minimum absolute time and not allow being set to values before min or after max?
If you know one, please point me not just to the library/module, but to the part of the documentation that describes how to do so. Or explain how to achieve those constraints. Thanks!
Posted on 16 Aug 2022, this text provides information on Web Development related to Web Technologies. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
Take Quiz To Earn Credits!
Turn Your Knowledge into Earnings.