1
0
Fork 0
mirror of https://github.com/maziggy/bambuddy.git synced 2026-05-09 08:25:54 +02:00

[GH-ISSUE #543] [Bug]: Timezone normlization breaks Maintenance #350

Closed
opened 2026-05-07 00:09:05 +02:00 by BreizhHardware · 1 comment

Originally created by @Keybored02 on GitHub (Feb 27, 2026).
Original GitHub issue: https://github.com/maziggy/bambuddy/issues/543

Bug Description

A regression exists in maintenance.py: in 0.2.2b1, timezone normalization for naive datetimes was removed in the maintenance date calculations (the last_performed_at math).
If any row has a naive last_performed_at, subtracting from datetime.now(timezone.utc) can throw TypeError (naive vs aware datetime), so /maintenance/overview fails.
Frontend behavior then looks like “no printers configured” because the query fails and the page falls back to empty-state UI.

Expected Behavior

Maintenance Page is usable.

Fixed by changing timezone handling:

if interval_type == "days":
            # Time-based: calculate days since last performed
            if last_performed_at:
                if last_performed_at.tzinfo is None:
                    last_performed_at = last_performed_at.replace(tzinfo=timezone.utc)
                days_since = (now - last_performed_at).total_seconds() / 86400.0

Steps to Reproduce

In 0.2.1:

  1. Open Maintenance Page

Printer Model

H2C

Bambuddy Version

0.2.1

Printer Firmware Version

01.01.05.00

Installation Method

Docker

Operating System

Docker

Relevant Logs / Support Package


Screenshots

No response

Additional Context

No response

Checklist

  • I have searched existing issues to ensure this bug hasn't already been reported
  • I am using the latest version of Bambuddy
  • My printer is set to LAN Only mode
  • My printer has Developer Mode enabled
Originally created by @Keybored02 on GitHub (Feb 27, 2026). Original GitHub issue: https://github.com/maziggy/bambuddy/issues/543 ### Bug Description A regression exists in `maintenance.py`: in `0.2.2b1`, timezone normalization for naive datetimes was removed in the maintenance date calculations (the `last_performed_at` math). If any row has a naive `last_performed_at`, subtracting from `datetime.now(timezone.utc`) can throw TypeError (naive vs aware datetime), so `/maintenance/overview` fails. Frontend behavior then looks like “no printers configured” because the query fails and the page falls back to empty-state UI. ### Expected Behavior Maintenance Page is usable. Fixed by changing timezone handling: ``` if interval_type == "days": # Time-based: calculate days since last performed if last_performed_at: if last_performed_at.tzinfo is None: last_performed_at = last_performed_at.replace(tzinfo=timezone.utc) days_since = (now - last_performed_at).total_seconds() / 86400.0 ``` ### Steps to Reproduce In 0.2.1: 1. Open Maintenance Page ### Printer Model H2C ### Bambuddy Version 0.2.1 ### Printer Firmware Version 01.01.05.00 ### Installation Method Docker ### Operating System Docker ### Relevant Logs / Support Package ```shell ``` ### Screenshots _No response_ ### Additional Context _No response_ ### Checklist - [x] I have searched existing issues to ensure this bug hasn't already been reported - [x] I am using the latest version of Bambuddy - [x] My printer is set to LAN Only mode - [x] My printer has Developer Mode enabled
BreizhHardware 2026-05-07 00:09:05 +02:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@Keybored02 commented on GitHub (Feb 27, 2026):

Fixed with a repull of 0.2.1, closing

<!-- gh-comment-id:3974888881 --> @Keybored02 commented on GitHub (Feb 27, 2026): Fixed with a repull of 0.2.1, closing
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/bambuddy-maziggy-1#350
No description provided.