Reputation: 1497
I am using KendoDateTimePicker.
We need to restrict user not to the select past time.
Eg: If current time is 2pm, time field should start from 2:10pm
$("#datetimepicker").kendoDateTimePicker({
value: '',
min: new Date(),
format: "dd MMM, yyyy hh:mm tt",
timeFormat: "hh:mm tt",
interval: 10,
});
.wrapper {width:300px;}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="https://kendo.cdn.telerik.com/2023.2.829/js/kendo.all.min.js"></script>
<link rel="stylesheet" href="https://kendo.cdn.telerik.com/themes/6.7.0/default/default-ocean-blue.css">
<div class="wrapper">
<input type="text" id="datetimepicker" />
</div>
Upvotes: 0
Views: 81
Reputation: 3872
You should use the startTime
field instead of the min
field, which is used to set the minimal date for the date picker.
You can set the mininal time selection to be now + 10
minutes like this:
const startTime = new Date();
startTime.setMinutes(startTime.getMinutes() + 10); // or const startTime = new Date(Date.now() + 10 * 60 * 1000)
$("#datetimepicker").kendoDateTimePicker({
value: '',
startTime: startTime,
format: "dd MMM, yyyy hh:mm tt",
timeFormat: "hh:mm tt",
interval: 10,
});
Upvotes: 1