Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] prevent Invalid DateTime #266

Closed
ghost opened this issue Dec 5, 2019 · 20 comments
Closed

[question] prevent Invalid DateTime #266

ghost opened this issue Dec 5, 2019 · 20 comments

Comments

@ghost
Copy link

ghost commented Dec 5, 2019

Hello,

I'd like to prevent user from entering invalid time into input field within timepicker. I have set: enableKeyboardInput="true" so when I toggle timepicker I can type into the fields above clock. They are restricted to only accept numbers, but I can input more than two digits or a value out of valid interval and then the field value changes to 'Invalid DateTime' which I have to remove to start setting time again. So I'd like to prevent user from entering invalid value or if they do, change the field value back to time the clock's showing. Is there a way to accomplish this?
Thanks for any suggestions.

@darioespositoW3
Copy link

Hi!,
I have a same issue.
Does anyone know how to fix this?

Thanks for advance.

@ghost
Copy link
Author

ghost commented Dec 10, 2019

This is what I'm doing now:
var dialInputs = document.getElementsByClassName('timepicker-dial__control'); if((<HTMLInputElement>dialInputs[0]).value.includes("Invalid DateTime")) (<HTMLInputElement>dialInputs[0]).value = "";
Setting value to empty string "" if there is "Invalid DateTime". I'd like to set it to value the clock is pointing to.

@Agranom
Copy link
Owner

Agranom commented Dec 11, 2019

Hi. How did you manage to input more than 2 numbers ? Can you reproduce it on the demo page https://agranom.github.io/ngx-material-timepicker/ ?

@ghost
Copy link
Author

ghost commented Dec 11, 2019

Hi. How did you manage to input more than 2 numbers ? Can you reproduce it on the demo page https://agranom.github.io/ngx-material-timepicker/ ?

Hello.
On your demo page in the "Editable dial" example, when you expand timepicker, you can type unlimited number of digits into the input fields above the clock.

@Agranom
Copy link
Owner

Agranom commented Dec 11, 2019

Are you typing into input field or into clock dial ?

@ghost
Copy link
Author

ghost commented Dec 11, 2019

Those two input fields above clock.

@Agranom
Copy link
Owner

Agranom commented Dec 11, 2019

It's strange, because I cannot type invalid time. Could you make a screenshot pls?

@ghost
Copy link
Author

ghost commented Dec 11, 2019

timePicker

@Agranom
Copy link
Owner

Agranom commented Dec 11, 2019

What the browser do you use?

@ghost
Copy link
Author

ghost commented Dec 11, 2019

Firefox, but I tried in explorer and edge and same behavior.

@Agranom
Copy link
Owner

Agranom commented Dec 11, 2019

Have you tried in chrome?

@ghost
Copy link
Author

ghost commented Dec 11, 2019

nope, I'll try

@ghost
Copy link
Author

ghost commented Dec 11, 2019

Ok, I tried in chrome its same in all browsers

@Agranom
Copy link
Owner

Agranom commented Dec 11, 2019

It's weird, cause I cannot reproduce it

@ghost
Copy link
Author

ghost commented Dec 11, 2019

Just tried it on phone, and there it works. Can't input three digits or invalid time.
Edit: I also noticed responsiveness (how the clock turns sideways to fit screen) only works with phone and not on desktop.

@Agranom
Copy link
Owner

Agranom commented Dec 21, 2019

I really don't know why it doesn't work for you on your PC

@kofizzz
Copy link

kofizzz commented Dec 30, 2019

Hi,

I can confirm that the issue reported is correct. If you enable free text typing into the field and click somewhere else on the page to remove the focus the error message will appear overriding the freehand text.

Might be nicer to allow custom validators to be set.

Thanks

@Totati
Copy link

Totati commented Jan 20, 2020

Hi, I can reproduce it in Windows 10, Chrome 79, Chromium Edge 79 too.

@Agranom
Copy link
Owner

Agranom commented Feb 29, 2020

The issue is resolved. Update to the latest version (v.5.4.0).

@Agranom Agranom closed this as completed Feb 29, 2020
@mynameisx666
Copy link

mynameisx666 commented Mar 13, 2020

@Agranom I installed 5.4.1 but this still exists
image

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants