feat(time picker): added min/max time constraints#6681
feat(time picker): added min/max time constraints#6681tlabaj merged 3 commits intopatternfly:mainfrom
Conversation
| maxTime = convertTo24Hour(maxTime); | ||
|
|
||
| // simple string comparison for 24hr times | ||
| return minTime <= time && time <= maxTime; |
There was a problem hiding this comment.
In your example, it looks like the max time is not included in the list. Should it be?
There was a problem hiding this comment.
@nicolethoen it shouldn't be included as it's currently designed, but we could change that. I'm not touching the time options that are created from the stepMinutes other than to remove any that are earlier than the min or greater than the max.
In the example, the stepMinutes defaults to 30 minute intervals and because the maxTime is 17:15 the last time option shown is 17:00 (as the next option, 17:30, is above the maxTime).
@mcarrano would you expect that we should add an additional time option with their max time (or min time) if it doesn't align with one of the existing time options? In my example, where maxTime=17:15, rather than the last option being 17:00 there would be one more that would be 17:15?
No I wouldn't expect this. The user could always enter that from the keyboard. Seems like pretty much an edge case. |
What: Closes #5853 and closes #6665
This PR:
minTime,maxTime, andinvalidMinMaxErrorMessageprops which enable restricting the options shown to a user and throwing an error if the user inputs a time outside the constraints.is24Hourprop is not present.