jQuery timepicker time format not working

14wml picture 14wml · May 12, 2017 · Viewed 12.3k times · Source

I have a timepicker form element:

<input type="text" name="start_time" class="timepicker" placeholder="Start Time*" required>

which I'm trying to format but it's not working:

enter image description here

I followed the documentation and added timeFormat like so:

  $('input.timepicker').timepicker({
    interval: 30,
    minTime: '8:00 am',
    maxTime: '11:30 pm',
    startTime: '8:00 am',
    timeFormat: 'h:mm p',
    dynamic: true,
    dropdown: true,
    scrollbar: true
  });

So I don't understand why it's not working. Any help would be appreciated!

JSFiddle

Answer

Edwin picture Edwin · May 12, 2017

The documentation posted by you it's not the same as in jquery-timepicker documentation. Then your timeFormat should be: timeFormat: 'h:i a'.

Somewhere on that documentation is written that the format uses the php date format: php date