Search code examples
jqueryjquery-ui-datepickerdatetimepickercustom-datetimepicker

DateTimePicker AM/PM Dropdown


I'm using (and loving) datetimepicker, the great add on to the jQuery UI Datepicker. However, I'm using the dropdown option (you can see all of them here -- http://trentrichardson.com/examples/timepicker/), and I want to have three dropdowns -- one for hours (1-12), minutes (00 to 60), and AM/PM.

Right now, the hours field also has the am/pm, and I'm not sure how to add another dropdown to control the AM/PM.

Here's my initialization:

$( ".datepicker" ).datetimepicker({
                        controlType: 'select',
                        timeFormat: "h:mm TT",
                        ampm: true
                });

I feel like this may be a very easy problem, but I can't find any real documentation that alludes to how I do this. Please help!


Solution

  • Quick solution:

    jquery-ui-timepicker-addon.js

    override or change "controlType: 'slider'," to "controlType: 'select',"