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) {
		frm.fields_dict.date.datepicker.update({ // Here date is the Todo field name.
            minDate: new Date(frappe.datetime.get_today()),
        });
	}
});

Maybe it helpful for you.

Thank You!

3 Likes

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