[Datepicker] showing only the previous day

Forge Component
(15)
Published on 2014-11-17 by Hugo Pinheiro
15 votes
Published on 2014-11-17 by Hugo Pinheiro

How to disable the current day is to leave showing only the previous day?

Do you want to show the previous day or also wants to disable current date in datepicker?

As, it's based on the https://jqueryui.com/datepicker, there are various options

For making previous date as default date https://api.jqueryui.com/datepicker/#option-defaultDate

$( ".selector" ).datepicker({  defaultDate: +7});

To disable current date, you may set maxDate to previous date https://api.jqueryui.com/datepicker/#option-maxDate

$( ".selector" ).datepicker({  maxDate: "-1d"});



Swatantra Kumar wrote:

Do you want to show the previous day or also wants to disable current date in datepicker?


I want to take the date today.

Daianne Caetano Figueredo Souza wrote:

Swatantra Kumar wrote:

Do you want to show the previous day or also wants to disable current date in datepicker?


I want to take the date today.

In this case, just instantiate the class without any defaultDate value (default is null, which means today)

$( ".selector" ).datepicker();