[SOLVED] Minimum date in "date" field

Hi guys

I need your help, please

what I want is to force a user to choose only date that is greater than 18 years in the “date field.”

For example, I set a field for a birthday date, so it’s not logical that user can choose “today” as its birthday date.

I hope someone can help me to code a script to achieve that.

thx in advance,

You can use this script to get the user age from date of birth date

After that you can use this python function to fire an alert and clear the field so he can enter a correct one
frappe.throw("Your Age is less than 18")


Hi dear OmarJaber

Thank you for your quick reply.

I am a new user at erpnext, and I still learning.
so can you please guide me where to but the python code?

I really appreciate your help

I mean how can I validate that someone is over 18 from their date of birth using your suggested python code, can u please provide me the full python code, and which path should I put it inside?

Thx in advance,