From 6e963cec51072c236c4f4932a17b6be00ca659d5 Mon Sep 17 00:00:00 2001 From: Jonas Linter Date: Thu, 16 Oct 2025 11:27:08 +0200 Subject: [PATCH] Fixed formatting for the pushover serivice --- src/alpine_bits_python/pushover_service.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/alpine_bits_python/pushover_service.py b/src/alpine_bits_python/pushover_service.py index 69aa955..130c528 100644 --- a/src/alpine_bits_python/pushover_service.py +++ b/src/alpine_bits_python/pushover_service.py @@ -204,10 +204,23 @@ class PushoverService: start = period.get("start", "") end = period.get("end", "") if start and end: - # Extract just the time portion - start_time = start.split(" ")[1] if " " in start else start - end_time = end.split(" ")[1] if " " in end else end - lines.append(f"Period: {start_time} - {end_time}") + # Parse the datetime strings to check if they're on different days + if " " in start and " " in end: + start_date, start_time = start.split(" ") + end_date, end_time = end.split(" ") + + # If same day, just show times + if start_date == end_date: + lines.append(f"Period: {start_time} - {end_time}") + else: + # Different days, show date + time in compact format + # Format: "MM-DD HH:MM - MM-DD HH:MM" + start_compact = f"{start_date[5:]} {start_time[:5]}" + end_compact = f"{end_date[5:]} {end_time[:5]}" + lines.append(f"Period: {start_compact} - {end_compact}") + else: + # Fallback if format is unexpected + lines.append(f"Period: {start} - {end}") # Total reservations total = stats.get("total_reservations", 0)