From d4f54bcff52c25e9215331ef9ffc6d510efb8296 Mon Sep 17 00:00:00 2001 From: "Troll (Hermes Agent)" Date: Wed, 12 Aug 2026 03:53:37 +0000 Subject: [PATCH] v0.8.9: Format email timestamps as 'Tuesday, August 8, 2026 @ 9:24pm' in America/Regina timezone Add regina_dt Jinja2 template filter that converts UTC ISO-8601 timestamps to America/Regina timezone and formats them as 'Weekday, Month D, YYYY @ H:MMam/pm'. Applied to preview_sent_at and delivery_sent_at on the admin request page. --- README.md | 2 +- VERSION | 2 +- app.py | 19 +++++++++++++++++++ templates/admin/request.html | 4 ++-- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index faaab11..646cbc1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Theme Song Booth (MusicGPT Edition) -![Version](https://img.shields.io/badge/version-v0.8.8-blue) +![Version](https://img.shields.io/badge/version-v0.8.9-blue) A Flask web application for running a convention booth where visitors request a custom AI-generated theme song. Operators manage the queue from an admin dashboard, generate prompts via Hermes, queue generations through the MusicGPT API, and deliver final songs by email. diff --git a/VERSION b/VERSION index 5c5cbb3..021abec 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.8.8 \ No newline at end of file +0.8.9 \ No newline at end of file diff --git a/app.py b/app.py index 0b1674f..3cb2b63 100644 --- a/app.py +++ b/app.py @@ -91,6 +91,25 @@ from helpers import ( app = Flask(__name__) app.config.from_object(Config) +# Template filter: format UTC ISO timestamp as "Tuesday, August 8, 2026 @ 9:24pm" in America/Regina. +from datetime import datetime, timezone +from zoneinfo import ZoneInfo + +_REGINA_TZ = ZoneInfo("America/Regina") + +@app.template_filter("regina_dt") +def regina_dt_filter(value): + if not value: + return "" + try: + dt = datetime.fromisoformat(value) + if dt.tzinfo is None: + dt = dt.replace(tzinfo=timezone.utc) + dt = dt.astimezone(_REGINA_TZ) + return dt.strftime("%A, %B %-d, %Y @ %-I:%M%p").replace("AM", "am").replace("PM", "pm") + except (ValueError, TypeError): + return value + # Global request rate limiting by remote IP (default 60/min). The public form is further limited to 5/min. limiter = Limiter(get_remote_address, app=app, default_limits=["60 per minute"]) diff --git a/templates/admin/request.html b/templates/admin/request.html index 19b2b67..4ff09cd 100644 --- a/templates/admin/request.html +++ b/templates/admin/request.html @@ -652,7 +652,7 @@

Preview email: {% if req.preview_sent_at %} - ✅ Sent {{ req.preview_sent_at }} + ✅ Sent {{ req.preview_sent_at|regina_dt }} {% else %} ❌ Not sent yet {% endif %} @@ -685,7 +685,7 @@

Delivery email: {% if req.delivery_sent_at %} - ✅ Sent {{ req.delivery_sent_at }} + ✅ Sent {{ req.delivery_sent_at|regina_dt }} {% else %} ❌ Not sent yet {% endif %}