Skip to content

Commit fa9327c

Browse files
committed
Updated DateTimeUtils to allow for bcss displaying timestamps in UTC
1 parent b9e4bcb commit fa9327c

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

utils/date_time_utils.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from datetime import datetime, timedelta
2+
import pytz
23

34

45
class DateTimeUtils:
@@ -71,14 +72,26 @@ def get_a_day_of_week(date: datetime) -> str:
7172
@staticmethod
7273
def report_timestamp_date_format() -> str:
7374
"""Gets the current datetime in the timestamp format used on the report pages."""
74-
return DateTimeUtils.format_date(datetime.now(), "%d/%m/%Y at %H:%M:%S")
75+
# Use this option if bcss is displaying correct DST times
76+
# return DateTimeUtils.format_date(datetime.now(), "%d/%m/%Y at %H:%M:%S")
77+
78+
# Use this option if bcss is displaying UTC times
79+
return DateTimeUtils.format_date(datetime.now(pytz.utc), "%d/%m/%Y at %H:%M:%S")
7580

7681
@staticmethod
7782
def fobt_kits_logged_but_not_read_report_timestamp_date_format() -> str:
7883
"""Gets the current datetime in the format used for FOBT Kits Logged but Not Read report."""
84+
# Use this option if bcss is displaying correct DST times
7985
return DateTimeUtils.format_date(datetime.now(), "%d %b %Y %H:%M:%S")
8086

87+
# Use this option if bcss is displaying UTC times
88+
# return DateTimeUtils.format_date(datetime.now(pytz.utc), "%d %b %Y %H:%M:%S")
89+
8190
@staticmethod
8291
def screening_practitioner_appointments_report_timestamp_date_format() -> str:
8392
"""Gets the current datetime in the format used for Screening Practitioner Appointments report."""
84-
return DateTimeUtils.format_date(datetime.now(), "%d.%m.%Y at %H:%M:%S")
93+
# Use this option if bcss is displaying correct DST times
94+
# return DateTimeUtils.format_date(datetime.now(), "%d.%m.%Y at %H:%M:%S")
95+
96+
# Use this option if bcss is displaying UTC times
97+
return DateTimeUtils.format_date(datetime.now(pytz.utc), "%d.%m.%Y at %H:%M:%S")

0 commit comments

Comments
 (0)