fix(convert_utc_to_timezone): set UTC if tzinfo undefined
Signed-off-by: Akhil Narang <me@akhilnarang.dev>
This commit is contained in:
parent
c4792204df
commit
4cf18d37bd
1 changed files with 1 additions and 1 deletions
|
|
@ -372,7 +372,7 @@ def get_system_timezone() -> str:
|
|||
|
||||
def convert_utc_to_timezone(utc_timestamp: datetime.datetime, time_zone: str) -> datetime.datetime:
|
||||
if utc_timestamp.tzinfo is None:
|
||||
utc_timestamp = utc_timestamp.replace(tzinfo=ZoneInfo(time_zone))
|
||||
utc_timestamp = utc_timestamp.replace(tzinfo=ZoneInfo("UTC"))
|
||||
|
||||
try:
|
||||
return utc_timestamp.astimezone(ZoneInfo(time_zone))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue