var timewsd = document.getElementById("current_datetime").value ;
var currentdate = "";
let roundDate = (date = new Date(timewsd), roundToMinutes = 60) => {
const ms = 1000 * 60 * roundToMinutes;
return new Date(Math.ceil(date.getTime() / ms) * ms);
};
var current_time = new Date(timewsd).getHours()+":"+new Date(timewsd).getMinutes();
const date = new Date(timewsd);
// if(current_time > '16:30'){
// currentdate = setDate(timewsd.getDate() + 1);
// }else{
// currentdate = document.getElementById("current_datetime").value;
// }
$("#kt_datepicker_2").flatpickr({
minDate: "today",
minuteIncrement: 1,
enableTime: true,
minTime :current_time
});
However when selecting a future date the time limits to the current time for the futiure date too.
2
Answers
Instead of using
minDate: "today"
replace it withminDate: new Date()
& also removeminTime
and you will get your desired output.Below, I have provided a live example for your reference.
If you want to disable past time and past date both then follow this code:
If you want to disable the date only then remove minTime element from a flatpicker config.