Conversation
…mePicker disablePast and min were two separate code paths computing the same thing (a lower bound for the calendar). min now doubles as the floor when disablePast is set, defaulting to today.
floor was only ever read once, immediately truncated into floorStart. Compute floorStart directly from minDate/today instead.
Every real call site already passed it explicitly. Flip the default and drop the now-redundant prop from callers.
No caller ever passed disablePast={false} — it was dead configurability.
The picker now unconditionally floors at min's day, or today.
minTime only fired when an explicit min prop was passed, so a picker with just the implicit "disable past" floor (no min) let you pick today's date and then any time, including ones already past. Compute a real minInstant (min, or now) so the time floor always applies on the floor day.
No caller ever passed it.
<input type="time" min=...> only flags rangeUnderflow for form validation — it never blocks the value from being entered or scrolled to in the field itself. Confirmed in-browser: typing 09:00 into today's time field was accepted with no visual feedback, even though "now" was 8:47pm. Clamp in onChange instead of trusting the browser to enforce min interactively.
This reverts commit c522e5b.
This reverts commit 7d2e131.
Clicking a calendar day alone (without touching the time field) defaulted to noon regardless of min, so picking today for the "ends" picker with a start already later than noon produced an end time before the start. Extract clampToMin and apply it in both onSelect and the time input's onChange. Confirmed live: start 9:51pm, click today on ends with no other input -> ends now clamps to 9:51pm instead of defaulting to noon.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1208
Summary
minprop to the DateTimePicker component to constrain the minimum allowed date/time<input type="time" min=...>attributeminvalueDetails
The issue was that users could scroll (on mobile datetime pickers) to select an end time earlier than the start time. This is now prevented at the UI level:
minattribute when on the same day to prevent scrolling to earlier times