Skip to content

Commit a11a1c0

Browse files
committed
fix(harvest): UTC-aware duration string conversion
1 parent 4a908eb commit a11a1c0

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

compiler_admin/services/harvest.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from datetime import datetime, timedelta
21
import os
32
import sys
3+
import time
4+
from datetime import timedelta
45
from typing import TextIO
56

67
import pandas as pd
@@ -22,7 +23,7 @@ def _calc_start_time(group: pd.DataFrame):
2223

2324
def _duration_str(duration: timedelta) -> str:
2425
"""Use total seconds to convert to a datetime and format as a string e.g. 01:30."""
25-
return datetime.fromtimestamp(duration.total_seconds()).strftime("%H:%M")
26+
return time.strftime("%H:%M", time.gmtime(duration.total_seconds()))
2627

2728

2829
def _toggl_client_name():

0 commit comments

Comments
 (0)