datepicker disable date based on time

后端 未结 1 723
梦谈多话
梦谈多话 2021-01-21 04:03

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 sel
1条回答
  •  盖世英雄少女心
    2021-01-21 04:21

    How about changing minDate according to hour of the day?

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

    0 讨论(0)
提交回复
热议问题