Skip to content

Commit

Permalink
fixed reminder timezones
Browse files Browse the repository at this point in the history
  • Loading branch information
Mole1424 committed Oct 1, 2023
1 parent a7a4c12 commit 2e5ad51
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cogs/commands/reminders.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ async def add(self, ctx: Context, when: str, *, reminder_content: str):
await ctx.send(**result)

def add_base(self, reminder):
now = utc.localize(datetime.now()).astimezone(timezone("Europe/London"))
now = datetime.now(timezone("Europe/London"))
if not reminder.trigger_at:
return {"content": "Incorrect time format, please see help text."}
elif reminder.trigger_at < now:
Expand Down
8 changes: 3 additions & 5 deletions utils/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,12 @@ def parse_time(time: str, /):
settings={
"DATE_ORDER": "DMY",
"PREFER_DATES_FROM": "future",
"TIMEZONE": "Europe/London",
"RETURN_AS_TIMEZONE_AWARE": True,
},
)

parsed_time = (
timezone("Europe/London").localize(parsed_time) if parsed_time else None
)

now = utc.localize(datetime.now()).astimezone(timezone("Europe/London"))
now = datetime.now(timezone("Europe/London"))

if not parsed_time:
try:
Expand Down

0 comments on commit 2e5ad51

Please sign in to comment.