Possibly fixed #8 #57

Merged
profitroll merged 10 commits from profitroll/timezones-fix into dev 2024-05-31 00:25:54 +03:00
2 changed files with 8 additions and 6 deletions
Showing only changes of commit e307d60e8e - Show all commits

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)