Search code examples
javascriptjquerytimepicker

Timepicker incrementing by 30 minutes, but want last time to be 11:59pm


I'm using a timepicker (https://www.jonthornton.com/jquery-timepicker/) and would like the last time option to be 11:59pm. I've included a jsfiddle with my complete code. I set maxTime but that doesn't impact the last time output. Any suggestions would be greatly appreciated.

https://jsfiddle.net/21r5d3ht/2/

          $(function() {
                $('#durationExample').timepicker({
                    'minTime': '9:00pm',
                    'maxTime': '11:59pm',
          'step': '30',
                    'showDuration': true
                });
            });

Solution

  • You can set the maxTime by using this:

    maxTime: new Date(0, 0, 0, 23, 59, 0),