fix: correct display time for snooze reminder in callback handler

This commit is contained in:
leo 2026-03-05 13:43:35 +08:00
parent eebfbf2243
commit 265a329f2c

View File

@ -1,5 +1,6 @@
from datetime import datetime, timedelta, timezone
import pytz
from telegram import Update
from telegram.ext import ContextTypes
@ -38,8 +39,10 @@ async def handle_callback(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
lambda ctx: execute_reminder(reminder_id, ctx.bot),
when=snooze_time,
)
tz = pytz.timezone("Asia/Shanghai")
display_time = snooze_time.astimezone(tz).strftime('%H:%M')
await query.edit_message_text(
f"⏰ 已延期10分钟将在 {snooze_time.strftime('%H:%M')} 再次提醒。"
f"⏰ 已延期10分钟将在 {display_time} 再次提醒。"
)
elif action == "pause":