Timepicker issue with defaultTime

325 Views Asked by At

i am using time picker my code and options are given below :

var options = {timeFormat: 'h:mm p', interval: 15, maxTime: '11:45pm', startTime: '12:00', defaultTime: new Date(),dynamic: true, dropdown: true, scrollbar: true}

$('.end_time,.start_time').timepicker(options);

it is returning me the output like :

it is working fine but it starts from the current time .what i want is i want it to start from 12:00am and end to 11:45pm like teams and google calender timepicker.

like that

this is what i actually want

from my timpicker i am getting this

Hello Ananad this is what i am taliking about: enter image description here

1

There are 1 best solutions below

4
On

var options = {timeFormat: 'h:mm p', interval: 15,minTime:"00:00am", maxTime: '11:45pm',  defaultTime: new Date(), startTime: '00:00am',dynamic: false, dropdown: true, scrollbar: true}

$('#time').timepicker(options);
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/timepicker/1.3.5/jquery.timepicker.min.js"></script>
<input id="time" />

Does this answer's your question. I had put dynamic as false as it was arranging result in chronological order.