react-datetime-picker
react-datetime-picker copied to clipboard
in AM/PM mode I can select a datetime less than minDate
I am trying to have a date picker that only allows future datetimes.
It is now 6:10pm, I set the minDate to minDate={new Date()}.
If I set the date picker to today, select the hour input and press up to 12, my picked datetime is 12pm which is in the past.
It feels like the hour input should start at 12 and go upto 11 ie 12 1 2 3 4 5 6 7 8 9 10 11, so pushing up always goes to the future. Pretty sure that's not possible with a regular HTML5 number input with min max attributes, but am sure it could be done in React.
Hi there, this is in the works in React-Time-Picker package which React-DateTime-Picker rely on for rendering hour inputs.
I really struggle though with proper validation here so I would rather accept too much than deny too much values. For instance, setting maxTime to 22:00 should allow 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 and 12 (no 11) in the number input.
This makes me feel like the input should somehow handle 12 like 0 and everything would be alright, but I need to find a solution that will somehow handle this complicated situation.
Thanks, understood. FYI I have managed to work around this for now by adding
if (minDate && minDate > date) date = minDate;
if (maxDate && maxDate < date) date = maxDate;
in my wrapper component date change handler.
Has there been any progress on this bug?
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this issue will be closed in 14 days.
This issue was closed because it has been stalled for 14 days with no activity.