user1561549
user1561549

Reputation: 33

datepicker disable date based on time

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?

Upvotes: 3

Views: 2084

Answers (1)

Ole Melhus
Ole Melhus

Reputation: 1929

How about changing minDate according to hour of the day?

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

Upvotes: 3

Related Questions