fix: use get_datetime_as_string with correct time format #43930
+3
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Timesheet and Timer use a mixture of d.format(frappe.defaultDatetimeFormat) and frappe.datetime.get_datetime_as_string().
Both until now do not respect the time format set in sysdefaults.
This can cause rounding errors when client side scripts calculate based upon unsubmitted values.
When sysdefaults TimeFormat is selected to be "HH:mm" and in a Timesheet a to_time or from_time with seconds is submitted, the hours field is calculated with seconds included. After submission the seconds are stripped from to_time or from_time, creating a missmatch of hours calculated and to_time - from_time.
This patch depends on fix: get_datetime_as_string should respect time_format in frappe and solves the rounding/missmatch problem, as well as cleans up the scripts to only use get_datetime_as_string.