Skip to content

"Now" Button returning 'pm' in the 'am', in 12 hour format #396

Open
@ncramer

Description

@ncramer

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions