From 3e4ca4219f9871b812c66b8e5ce381a92444f6db Mon Sep 17 00:00:00 2001 From: Makarand Bauskar Date: Wed, 18 Oct 2017 11:16:47 +0530 Subject: [PATCH] [hotfix] fixed 'ValueError: Unknown string format' error if the from_time value is null (#11162) --- erpnext/projects/doctype/timesheet/timesheet.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/erpnext/projects/doctype/timesheet/timesheet.js b/erpnext/projects/doctype/timesheet/timesheet.js index ba1414cf2a6..1ea59629115 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.js +++ b/erpnext/projects/doctype/timesheet/timesheet.js @@ -159,9 +159,14 @@ frappe.ui.form.on("Timesheet Detail", { }); var calculate_end_time = function(frm, cdt, cdn) { - var child = locals[cdt][cdn]; + let child = locals[cdt][cdn]; - var d = moment(child.from_time); + if(!child.from_time) { + // if from_time value is not available then set the current datetime + frappe.model.set_value(cdt, cdn, "from_time", frappe.datetime.get_datetime_as_string()); + } + + let d = moment(child.from_time); if(child.hours) { d.add(child.hours, "hours"); frm._setting_hours = true;