From 3e828c05d98a7ee82064d76ed371d81b36292f7b Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Wed, 7 Dec 2022 14:59:40 +0100 Subject: [PATCH] Send datetimes with timezone when scheduling This fixes this feature on Pleroma --- toot/commands.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/toot/commands.py b/toot/commands.py index d67f63a..0340eb9 100644 --- a/toot/commands.py +++ b/toot/commands.py @@ -2,7 +2,7 @@ import sys -from datetime import datetime, timedelta +from datetime import datetime, timedelta, timezone from toot import api, config from toot.auth import login_interactive, login_browser_interactive, create_app_interactive from toot.exceptions import ApiError, ConsoleError @@ -132,8 +132,8 @@ def _get_scheduled_at(scheduled_at, scheduled_in): return scheduled_at if scheduled_in: - scheduled_at = datetime.utcnow() + timedelta(seconds=scheduled_in) - return scheduled_at.isoformat() + scheduled_at = datetime.now(timezone.utc) + timedelta(seconds=scheduled_in) + return scheduled_at.replace(microsecond=0).isoformat() return None