How not restrict old date selection from Calender for a custom field

I want to have have old dates greyed out in the calender. Such that the used should not be able to select them.

I can do validation post selection, but that would be the user has to try a few dates before find out which date he can select.

this is something akin to travel booking websites where only available travel dates are shown.

Hi @dhananjay,

I don’t konw, how will worked in dialog but i share my custom/client script for previous date disable from date picker.

Please check it, we set in Todo list.

frappe.ui.form.on('ToDo', {
	refresh: function(frm) {{ // Here date is the Todo field name.
            minDate: new Date(frappe.datetime.get_today()),

Maybe it helpful for you.

Thank You!


Thanks, I think that should help

It works but when the user click on Today button below the calendar today date is selected and populated in the field even if it is less than the minDate.

Is there any work around to overide the functionality of this button

I think you can try using jquery to find dates using the css class

<div class="datepicker--cell datepicker--cell-day -other-month-" data-date="29" data-month="0" data-year="2024">29</div>

Once you have the DOM, you can try changing the onClick events.