pytz.utc instead of datetime.timezone.utc

This commit is contained in:
Profitroll 2024-05-30 23:18:58 +02:00 committed by Profitroll
parent 0562521f0d
commit e307d60e8e
2 changed files with 8 additions and 6 deletions

View File

@ -1,6 +1,7 @@
import logging
from datetime import datetime, timezone
from datetime import datetime
import pytz
from convopyro import listen_message
from pyrogram import filters
from pyrogram.types import ForceReply, Message, ReplyKeyboardRemove
@ -65,9 +66,9 @@ async def command_set_offset(app: PyroClient, message: Message):
logger.info("User %s has set offset to %s", user.id, offset)
garbage_time = (
datetime.now(timezone.utc)
datetime.now(pytz.utc)
.replace(hour=user.time_hour, minute=user.time_minute)
.astimezone(user.location.timezone or timezone.utc)
.astimezone(user.location.timezone or pytz.utc)
)
await answer.reply_text(

View File

@ -1,5 +1,6 @@
from datetime import datetime, timedelta, timezone
from datetime import datetime, timedelta
import pytz
from pyrogram import filters
from pyrogram.types import Message
@ -23,11 +24,11 @@ async def command_upcoming(app: PyroClient, message: Message):
date_min = (
datetime.now(user.location.timezone).replace(second=0, microsecond=0)
).replace(tzinfo=timezone.utc)
).replace(tzinfo=pytz.utc)
date_max = (
datetime.now(user.location.timezone).replace(second=0, microsecond=0)
+ timedelta(days=30)
).replace(tzinfo=timezone.utc)
).replace(tzinfo=pytz.utc)
entries = [
await GarbageEntry.from_record(entry)