3
votes

I have a datepicker on my website but now I want to disable days based on time. I want to achieve 2 things:

  1. I want to disable today, user should not be able to select today's date.
  2. Everyday after 2:00pm I want to disable tomorrow also.

Is it possible through jquery?

1
Are you using the jQuery UI datepicker ? - Vatev

1 Answers

3
votes

How about changing minDate according to hour of the day?

var hour = new Date().getHours();
$("element").datepicker({ minDate: hour >= 14 ? 2 : 1});