How to ristrict future date in datepicker

I want to ristrict user by selecting future date.

Hi @Ashlesh,

That for please apply custom/client script.

// Syntax
frappe.ui.form.on("Your Doctype", "validate", function(frm) {
    if (frappe.user == "your_user_id@gmail.com") {
        if (frm.doc.your_date > get_today()) {
            frappe.msgprint(__("You can not select future date"));
            frappe.validated = false;
        }
    }
});

// Example
frappe.ui.form.on("Sales Order", "validate", function(frm) {
    if (frappe.user == "user.xyz@gmail.com") {
        if (frm.doc.transaction_date > get_today()) {
            frappe.msgprint(__("You can not select future date"));
            frappe.validated = false;
        }
    }
});

Thank You!

2 Likes

Hi Thanks its working properly.