[bug] Leave application ui issues fixed (#13740)
* validate to_date in leave application
if to_date is less than from_date show message to user
reset to_date value to ''
* var declaration and semicolon missed
* Updated popup message
diff --git a/erpnext/hr/doctype/leave_application/leave_application.js b/erpnext/hr/doctype/leave_application/leave_application.js
index 085fa3c..242c987 100755
--- a/erpnext/hr/doctype/leave_application/leave_application.js
+++ b/erpnext/hr/doctype/leave_application/leave_application.js
@@ -110,6 +110,15 @@
calculate_total_days: function(frm) {
if(frm.doc.from_date && frm.doc.to_date && frm.doc.employee && frm.doc.leave_type) {
+
+ var from_date = Date.parse(frm.doc.from_date);
+ var to_date = Date.parse(frm.doc.to_date);
+
+ if(to_date < from_date){
+ frappe.msgprint(__("To Date cannot be less than From Date"));
+ frm.set_value('to_date', '');
+ return;
+ }
// server call is done to include holidays in leave days calculations
return frappe.call({
method: 'erpnext.hr.doctype.leave_application.leave_application.get_number_of_leave_days',