Repository navigation
TimeRangeField: allow time ranges that cross midnight (e.g. 22:00 → 06:00)? #3012
abouletwiiisdom
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Hi! I'd like to hear how others handle this case with
TimeRangeField.Current behavior
TimeRangeFieldRootcomparesstartandendas times on the same day. Whenendis beforestart,isInvalidistrue(the!isBeforeOrSame(start, end)check). The value is still emitted, but every segment getsaria-invalid="true"anddata-invalid. As far as I can tell (2.11.0), no prop changes this.Our case
We use a time range to define a daily window in which a recurring task is allowed to run. A window that crosses midnight is valid for us:
22:00 → 06:00means "from 10 PM until 6 AM the next morning", and our backend already handles it.With
TimeRangeField, this works functionally, but screen readers announce the range as invalid, and it would look like an error as soon asdata-invalidis styled. For now we use two separateTimeFields instead.Question
Should
TimeRangeFieldsupport this? Some ideas, open to others:TimeFields is the recommended approach for this caseThanks!
All reactions