Skip to content

Fix day label off-by-one in parse_open_meteo_forecast#613

Open
malawto wants to merge 1 commit intofatihak:mainfrom
malawto:fix/openmeteo-forecast-day-label
Open

Fix day label off-by-one in parse_open_meteo_forecast#613
malawto wants to merge 1 commit intofatihak:mainfrom
malawto:fix/openmeteo-forecast-day-label

Conversation

@malawto
Copy link
Copy Markdown

@malawto malawto commented Feb 27, 2026

Fix day label and moon phase off-by-one in parse_open_meteo_forecast

Open-Meteo daily time values are date strings (e.g. "2026-02-27"), not datetimes. The previous code parsed them with .replace(tzinfo=timezone.utc).astimezone(tz), which stamped them as UTC midnight and then shifted them into local time — rolling each date back to the previous evening. This caused every forecast card to display the wrong day label and the wrong day's high/low temperatures.

A timedelta(days=1) offset on target_date in the moon phase calculation was silently compensating for this same bug, keeping moon phases accidentally correct.

This PR fixes the date parsing by using date.fromisoformat() directly, and removes the timedelta(days=1) offset that was masking the original error. The result is correct day labels, correct temperatures in each forecast card, and correct moon phases.

pjleduc added a commit to pjleduc/InkyPi that referenced this pull request Mar 15, 2026
- calendar.py: skip failed calendar URLs instead of crashing plugin
- weather.py: fix Open-Meteo forecast day label off-by-one (PR fatihak#613)
- model.py: remove duplicate scheduled refresh logic
- refresh_task.py: add 60s timeout to prevent indefinite hangs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant