Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Laracast13's avatar

jQuery DateTimePicker do not show past time

Hi, Using jQuery DateTimePicker https://github.com/xdan/datetimepicker

I have allowed show 1 month and time between 8:00 - 18:00

But when time is for ex. 11:00 it still show past time 8:00 9:00 .... Do not show past time, how can I do this?

    $('#datetimepicker').datetimepicker({
       format: 'H:i:s/d.m.Y',
       step: 15,
       startDate:new Date(),
       minDate: 0,
       maxDate:'+1970/01/30',
       minTime:'8:00',
       maxTime:'18:00',
    });
0 likes
1 reply
neilstee's avatar
neilstee
Best Answer
Level 34

@www888 from the Github issue:

var minDateTime =  new Date();
minDateTime.setHours(minDateTime.getHours()-1);
$("#timePkr").datetimepicker({
    minDate: 0,
    minDateTime: minDateTime,
    todayButton: true,
    closeOnWithoutClick: true,
    scrollInput: false,
    closeOnDateTimeSelect: true,
    defaultTime: minDateTime.getHours() + ":" + minDateTime.getMinutes()
 });

Source: https://github.com/xdan/datetimepicker/issues/424

Please or to participate in this conversation.