wvega / timepicker

A jQuery plugin to enhance standard form input fields helping users to select (or type) times
http://timepicker.co
GNU General Public License v2.0
216 stars 93 forks source link

Invalid time changes to different valid time when parsed. #109

Open dandersonMLT opened 6 years ago

dandersonMLT commented 6 years ago

I noticed that if the user incorrectly types an invalid time, the time picker will still try to parse the string and sometimes change it to an valid, but different time.

For example, if the user tries to enter "9:12a" but accidentally enters "99:12a" the time picker will parse it to "10:31 AM"

This causes any page input validation to succeed since 10:31 AM is a valid time, but records the incorrect time as the user really wanted to enter 9:12 AM.

Can you add an option so the string will not parse or will be cleared if the time entered in invalid? This way we can force the user to fix it: 1) greater than 24 hours 2) greater than 12 hours with am/pm entered 3) greater than 59 minutes

Thank you!