fix: add function for timedelta conversion

This commit is contained in:
Himanshu Warekar 2019-06-21 22:57:06 +05:30
parent f5262c54ff
commit d1ca820e1e

View File

@ -7,7 +7,7 @@ import json
from frappe import _
from frappe import utils
from frappe.model.document import Document
from frappe.utils import now, time_diff_in_hours, now_datetime, getdate, get_weekdays, add_to_date, today, get_time, get_datetime, get_time_in_timedelta
from frappe.utils import now, time_diff_in_hours, now_datetime, getdate, get_weekdays, add_to_date, today, get_time, get_datetime
from datetime import datetime, timedelta
from frappe.model.mapper import get_mapped_doc
from frappe.utils.user import is_website_user
@ -366,3 +366,9 @@ def make_issue_from_communication(communication, ignore_communication_links=Fals
link_communication_to_document(doc, "Issue", issue.name, ignore_communication_links)
return issue.name
def get_time_in_timedelta(time):
"""
Converts datetime.time(10, 36, 55, 961454) to datetime.timedelta(seconds=38215)
"""
return datetime.timedelta(hours=time.hour, minutes=time.minute, seconds=time.second)