Custom script for defined date validation

If user enter invoice date greater than 31-May-2016 then validation should be false.

frappe.ui.form.on("Sales Invoice", "validate", function(frm) {
    if (frm.doc.Date > "2016-05-31") {
        msgprint("Complete Invoice Till 31st May 2016");
        validated = false;
        return;
    }
});

correct fieldname is doc.posting_date

see:

https://frappe.github.io/erpnext/current/models/accounts/sales_invoice.html

Thanks a lot.