-
Notifications
You must be signed in to change notification settings - Fork 1k
"Now" Button returning 'pm' in the 'am', in 12 hour format #396
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
Comments
Fixes trentrichardson#396 by comparing in a case-insensitive manner.
The input field is populated with the correct am/pm designation, but the picker itself still displays 'pm' when you use the 'now' option. |
I take that back...it does not populate correctly. |
Several different quick solutions that may work and don't require a ton of code review, not familiar enough with the full codebase to confirm there are no unintended consequences:
I don't know that any of these are "right" but hopefully will point you in the right direction. |
that worked for me. thanks. |
Example:
At 1:40AM click the Now button in example 2 - http://trentrichardson.com/examples/timepicker/
"Show time in AM/PM 12 hour format"
$('#example2').datetimepicker({ampm: true});
Expected result:
07/28/2012 01:40 am
Actual result:
07/28/2012 01:40 pm
Issue:
Default time format for ampm is hh::ss tt (lowercase am/pm)
But, at line 973 we state:
ampm = $.inArray(treg[order.t], o.amNames) !== -1 ? 'AM' : 'PM';
And the default regional codes fo are caps:
amNames: ['AM', 'A'],
pmNames: ['PM', 'P'],
So since 'am' is not in ['AM', 'A'], PM is always returned
At a minimum I would make the defaults consistent. Better, I'd compare in a case-insensitive manner or use the value directly.
The text was updated successfully, but these errors were encountered: