Skip to content

Commit c635b9d

Browse files
committed
change timezone package
1 parent 1d8e015 commit c635b9d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

delta_backend/src/ConversionChecker.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33
# Root and base type expression checker functions
44
import ExceptionMessages
55
from datetime import datetime,timedelta
6-
import uuid
7-
import pytz
6+
from zoneinfo import ZoneInfo
87
import re
98
from LookUpData import LookUpData
109

@@ -129,7 +128,8 @@ def _convertToDateTime(self, expressionRule, fieldName, fieldValue, summarise, r
129128

130129
# Allow only +00:00 or +01:00 offsets (UTC and BST) and reject unsupported timezones
131130
offset = dt.utcoffset()
132-
allowed_offsets = [timedelta(hours=0), timedelta(hours=1)]
131+
allowed_offsets = [ZoneInfo("UTC").utcoffset(dt),
132+
ZoneInfo("Europe/London").utcoffset(dt)]
133133
if offset not in allowed_offsets:
134134
raise RecordError(
135135
ExceptionMessages.RECORD_CHECK_FAILED,
@@ -138,7 +138,7 @@ def _convertToDateTime(self, expressionRule, fieldName, fieldValue, summarise, r
138138
)
139139

140140
# Convert to UTC
141-
dt_utc = dt.astimezone(pytz.UTC).replace(microsecond=0)
141+
dt_utc = dt.astimezone(ZoneInfo("UTC")).replace(microsecond=0)
142142

143143
format_str = expressionRule.replace("format:", "")
144144

0 commit comments

Comments
 (0)