Prevent user to select date before today on datepicker

Hi, is it possible to block dates or disable the dates on the datepicker. For example: in leave application module employee only able to apply their leave not less than 7 days before their leave. Thus is it possible to block 7 days on the datepicker from today.

yes, it is possible

Could you please share some examples or references to achieve this. I could not find the way to this anywhere. Most of the thread leads to create a validation check instead of blocking the datepicker. Thank you.

please check this document


Thank you so much for your reply
Though i have a question.

is there a specific syntax i have to use to link it to the from_date?
for example employee cannot select any day before today.

minDate: new Date(2007, 1 - 1, 1)

When i try to implement the script it still does not block the other dates
this is my script
Thank you

minDate: frappe.datetime.get_today()

I have adjust but i can still choose other dates :frowning:

Try this

minDate: new Date(2007, 1 - 1, 1)

refresh: function (frm) {{
minDate: new Date(frappe.datetime.get_today()),

“date” is the field name

1 Like