pytz.utc instead of datetime.timezone.utc
This commit is contained in:
parent
0562521f0d
commit
e307d60e8e
@ -1,6 +1,7 @@
|
|||||||
import logging
|
import logging
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime
|
||||||
|
|
||||||
|
import pytz
|
||||||
from convopyro import listen_message
|
from convopyro import listen_message
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.types import ForceReply, Message, ReplyKeyboardRemove
|
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)
|
logger.info("User %s has set offset to %s", user.id, offset)
|
||||||
|
|
||||||
garbage_time = (
|
garbage_time = (
|
||||||
datetime.now(timezone.utc)
|
datetime.now(pytz.utc)
|
||||||
.replace(hour=user.time_hour, minute=user.time_minute)
|
.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(
|
await answer.reply_text(
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
from datetime import datetime, timedelta, timezone
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
import pytz
|
||||||
from pyrogram import filters
|
from pyrogram import filters
|
||||||
from pyrogram.types import Message
|
from pyrogram.types import Message
|
||||||
|
|
||||||
@ -23,11 +24,11 @@ async def command_upcoming(app: PyroClient, message: Message):
|
|||||||
|
|
||||||
date_min = (
|
date_min = (
|
||||||
datetime.now(user.location.timezone).replace(second=0, microsecond=0)
|
datetime.now(user.location.timezone).replace(second=0, microsecond=0)
|
||||||
).replace(tzinfo=timezone.utc)
|
).replace(tzinfo=pytz.utc)
|
||||||
date_max = (
|
date_max = (
|
||||||
datetime.now(user.location.timezone).replace(second=0, microsecond=0)
|
datetime.now(user.location.timezone).replace(second=0, microsecond=0)
|
||||||
+ timedelta(days=30)
|
+ timedelta(days=30)
|
||||||
).replace(tzinfo=timezone.utc)
|
).replace(tzinfo=pytz.utc)
|
||||||
|
|
||||||
entries = [
|
entries = [
|
||||||
await GarbageEntry.from_record(entry)
|
await GarbageEntry.from_record(entry)
|
||||||
|
Reference in New Issue
Block a user