[Datepicker] showing only the previous day
Question
Datepicker
Web icon
Forge component 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?

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();


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"});



Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.