jdewit / bootstrap-timepicker

[Deprecated] A simple timepicker component for Twitter Bootstrap
MIT License
1.64k stars 1.09k forks source link

Increment/Decrement Hour arrows can leave the minutes and seconds empty #348

Open Hilgo opened 8 years ago

Hilgo commented 8 years ago

Similar to #194 , but this concerns the minutes and seconds part of the input. When user changes the hour arrows and the input is clear (no value), it sets the hour (can be negative, informed in #194) but not set minutes or seconds, leaving it empty.

In my case, i didn't include any validations to validate this format, with minutes and second empty and the user is saving without minutes but the time in the database is empty. Am i missing some configuration or do I have do validate this format myself? I could do this using a mask on those inputs, forcing the format or i could update the values before submitted, something like this:

$('.timepicker').each(function(){
    $(this).timepicker('setTime', $(this).val());   
});

Or anyone with a better solution? Didn't get a time to debug the bootstrap-timepicker js to see where this behavior is coming to update it and i don't have experience with contributing to other projects in GitHub.

I created a Fiddle to illustrate this behavior. Library versions of this fiddle, provided by cdnjs links:

Tested in Windows 8.1 and browsers:

Decided to create a new issue, since its different from #194 and couldn't find this specific issue already reported. Sorry if it was already posted.

And here's a print screen of the input with no values for minutes and seconds, to be more clear to understand.

bootstrap timepicker - increment or decrement hour arrows