question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[MaterialTimePicker] Add Input validation

See original GitHub issue

Is your feature request related to a problem? Please describe. Many times, apps need users to select a date+time in the past/future. MaterialDatePicker solves this problem by having the option to add constraints with a validator. TimePicker doesn’t allow any such option.

Describe the solution you’d like An addConstraints implementation for MaterialTimePicker. I understand that it won’t be possible to simply extend CalendarConstraints for this because the time picker is only concerned with time but an option to add constraints in the form of (say) constraintBefore(int hour, int minute) and constraintAfter(int hour, int minute) can be added.

Describe alternatives you’ve considered The present alternative to this I am using is to manually check the time from the TimePicker and reset the time if it doesn’t fall within the required constraints. (Say I only allow time to be selected in the past, but user has entered a future time. I reset the displayed time to the current time). But this leaves room for a bad UX where the user can get confused or not even realize their selected time has been changed.

Additional context An example implementation can be this library I found on Github

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:10
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
drchencommented, Nov 15, 2021

Hi I think disabling OK button is feasible since it has less UX impact. Regarding your suggestion - we may need to consult with our UX designers and see what they think, which, may take a much longer time.

I’ll raise the idea internally first and check if we can add support to disable OK button first.

0reactions
Red7Mcommented, Nov 30, 2022

Just so we know, are time constraints a “in progress” work currently?

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Validation on timepicker according to date selection
I validated the Time Picker as i compare current time to selected time and set message "Select Correct time",it's working correctly when select ......
Read more >
How to create material date and time pickers in android.
The default input mode is MaterialTimePicker. ... In a situation where the input mode is INPUT_MODE_TEXT, the user gets a validation error when...
Read more >
ng material time picker Code Example - Code Grepper
<input mdc-datetime-picker="" date="true" time="true" type="text" ... Add a Grepper Answer ... angular material datepicker start and end date validation ...
Read more >
ngx-material-timepicker - npm
Start using ngx-material-timepicker in your project by running `npm i ... Set true to disable opening timepicker by clicking on the input ......
Read more >
React Time Picker component - MUI X
These are rendered without a wrapper or outer logic (masked input, date values parsing and validation, etc.). 001234567891011121314151617181920212223.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found