From 0c83f48f78a35dd49745a2205a7fc258fd0c6b71 Mon Sep 17 00:00:00 2001 From: "lukas.brandhoff" Date: Wed, 30 Oct 2024 11:46:21 +0000 Subject: [PATCH] fix: use get_datetime_as_string with correct time format --- erpnext/projects/doctype/timesheet/timesheet.js | 2 +- erpnext/public/js/projects/timer.js | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/erpnext/projects/doctype/timesheet/timesheet.js b/erpnext/projects/doctype/timesheet/timesheet.js index ef4595c1733..3ac68b69e43 100644 --- a/erpnext/projects/doctype/timesheet/timesheet.js +++ b/erpnext/projects/doctype/timesheet/timesheet.js @@ -356,7 +356,7 @@ var calculate_end_time = function (frm, cdt, cdn) { if (child.hours) { d.add(child.hours, "hours"); frm._setting_hours = true; - frappe.model.set_value(cdt, cdn, "to_time", d.format(frappe.defaultDatetimeFormat)).then(() => { + frappe.model.set_value(cdt, cdn, "to_time", frappe.datetime.get_datetime_as_string(d)).then(() => { frm._setting_hours = false; }); } diff --git a/erpnext/public/js/projects/timer.js b/erpnext/public/js/projects/timer.js index 10f06272189..73ff4ba09bd 100644 --- a/erpnext/public/js/projects/timer.js +++ b/erpnext/public/js/projects/timer.js @@ -89,7 +89,7 @@ erpnext.timesheet.control_timer = function (frm, dialog, row, timestamp = 0) { let d = moment(row.from_time); if (row.expected_hours) { d.add(row.expected_hours, "hours"); - row.to_time = d.format(frappe.defaultDatetimeFormat); + row.to_time = frappe.datetime.get_datetime_as_string(d); } frm.refresh_field("time_logs"); frm.save(); @@ -117,8 +117,7 @@ erpnext.timesheet.control_timer = function (frm, dialog, row, timestamp = 0) { grid_row.doc.project = args.project; grid_row.doc.task = args.task; grid_row.doc.expected_hours = args.expected_hours; - grid_row.doc.hours = currentIncrement / 3600; - grid_row.doc.to_time = frappe.datetime.now_datetime(); + grid_row.doc.to_time = frappe.datetime.get_datetime_as_string(); grid_row.refresh(); frm.dirty(); frm.save();