-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix 24h display when showMeridian is false. #209
base: gh-pages
Are you sure you want to change the base?
Conversation
Thanks! This was just causing a problem in our input validation. |
@dietherw: No problem. It was definitely needed! |
Did the trick. Awesome work thanks! I noticed that when the field is empty, and I change hours (now hours are working great) in minutes field I get '0' when I should get '00' this happens until I change minutes value. I know, this is a minor issue, but I'm in the obligation to report ir. |
nice, better have both options as some locale use always 2 digits ( fr, de..), some not (it, nl..) |
this should fix jdewit#219 jdewit#209 jdewit#208 jdewit#203, jdewit#209 has tests not yet included here JSBIN http://jsbin.com/xahux/3
@astjohn In my opinion we are talking about 2 distinct things: sending user input/localized data and sending a format, both with their use case. Sometimes (maybe often) one may have the possibility of sending a format but only when scripts are active; one cannot ask a user to type ISO8601 for a date-time, for time alone I admit, you might ;-) however in some cultures they might be not be happy to type 24-hours time. I use the picker to send localized data, same as appears in the input. The reason is that is there are no scripts enabled the widget degrades gracefully to something that can be used: a standard input type='text' in which the user may type his time in his/current language. I read localized data on the server in both cases. For this reason I said is better to have an option. Btw just yesterday I updated a version of the picker since I had already this case in mind, may be inspired by this same thread, so I made an option to always send ISO and display localized, in this way the user can use AM/PM but always send 24H ISO. I would appreciate if you test whether it suits your use case, there should be also some other bug fixes, I am waiting to see if I can merge here, I have tried to not change the original default behavior. You may test the two digits here [data-two-digits-hour='true'] http://jsbin.com/xahux A warning: I am linking the jscript 'live' from my github project https://raw.githubusercontent.com/eleumik/bootstrap-timepicker/gh-pages/js/bootstrap-timepicker.js and only Mozilla still allows that, other browsers may not work. Let me know if I can help, sorry for being so long but I took the occasion to summarize what I am doing, thanks. https://github.com/eleumik/bootstrap-timepicker http://jsbin.com/kexil/6 (localization showcase) |
this should fix jdewit#219 jdewit#209 jdewit#208 jdewit#203, jdewit#209 has tests not yet included here JSBIN http://jsbin.com/xahux/3 see: eleumik@7a5a84a
This pull request adds a simple padding method for use when showMeridian is false and elsewhere. I added one extra spec for testing. 24 hour times should now have double digits on display. This should fix #208.
I also noted that the pull request #203 did not actually set the display, only the underlying values. In my opinion, this pull request has a cleaner and easier to read solution.