Hi
How to validate the date from datetime data type, with today’s date please help me.
Hi @jinsy,
Please apply check:
doc.dnt → datetime field
frappe.ui.form.on("Sales Order", "validate", function(frm) {
if (frm.doc.dnt < get_today()) {
frappe.msgprint(__("You can not select past date in From Date"));
frappe.validated = false;
}
});
Also check below image:
Thank You!
Thank you its working But for I want check tha date is today’s date
if(frm.doc.contact_date === get_today())
contact_date is my datetime field
But not working
Please help me
Hi . This is my code
contact_date:function(frm)
{
if(frm.doc.contact_date == get_today())
{
frappe.msgprint("Today ");
// frm.set_value("meeting_scheduled_today",0)
}
},
not working.
if(frm.doc.contact_date<get_today()) & if(frm.doc.contact_date > get_today())
is working but == not.
Hi @jinsy,
frappe.ui.form.on("Sales Order", "contact_date", function(frm) {
if (frm.doc.contact_date == get_today()) {
frappe.msgprint(__("Today "));
}
});
apply full script and check
100% work for my side.
Thank You!
Hi @jinsy,
In sales order custom field to work but
Try another way to create script
frappe.ui.form.on("Lead", "contact_date", function(frm) {
var date = new Date(frm.doc.contact_date).toISOString().slice(0,10);
console.log(date);
if (date == get_today()) {
frappe.msgprint(__("You can not select Today"));
}
});
Please check Image:
Thank You!
1 Like
Thank you so much you help me a lot. I am new to this field Thank you for your instant reply to my problem.
1 Like