Problems with my datetimepicker time

2

I'm creating a calendar and I do not want to allow you to select past dates, in the js I'm placing the following:

<script>
$('.datepicker-default').datetimepicker({
    language:'es',
    daysOfWeekDisabled: [0, 6],
    todayHighlight: true,
    autoclose: true,
    startDate: '-0d',
    format: 'dd/mm/yyyy hh:ii',
});
</script>

It works well for the day but for the hour not , since it is 4:05 pm and it does not allow me to select the 17 hours but it is enabled 18 hours (As I show in the image)

    
asked by Alexandra Teran 23.04.2018 в 21:09
source

1 answer

0

datetimepicker offers you the minDate and minTime methods

An example of this:

$(function () {

    $("#datepicker").datetimepicker({
        language: 'es',
        daysOfWeekDisabled: [0, 6],
        todayHighlight: true,
        autoclose: true,
        format: 'dd/mm/yyyy hh:ii',
        minDate: 0,
        minTime: new Date().getTime()
    });
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.full.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.css" rel="stylesheet"/>



<input type="text" id="datepicker">
    
answered by 23.04.2018 в 21:56