Skip to content

Commit

Permalink
fix timezone conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
yurnov committed Mar 26, 2024
1 parent e6b25bf commit 553998b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bot/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from dotenv import load_dotenv
import time
from datetime import datetime, timedelta
from pytz import timezone
import pytz

"""
This is a simple telegram bot that every 30 secound get API http://alerts.net.ua/explosives_statuses_v2.json and send
Expand Down Expand Up @@ -173,8 +173,8 @@ def main():
logger.info(f"Explosion in region: {region}, date: {date}")

message += f"{regions_gram_case.get(region, region)} о {datetime\
.strptime(date,'%Y-%m-%dT%H:%M:%S+00:00')\
.replace(tzinfo=timezone.utc).astimezone(TIMEZONE).strftime('%H:%M')}\n"
.strptime(date,'%Y-%m-%dT%H:%M:%S+00:00').replace(tzinfo=pytz.utc)\
.astimezone(tz=pytz.timezone(TIMEZONE)).strftime('%H:%M')}\n"

if message != MESSAGE:
message += "\nЙобанарусня!"
Expand Down

0 comments on commit 553998b

Please sign in to comment.