Skip to content

fix: handle MM/dd/yyyy HH:mm:ss date format from NordPool API#111

Merged
sondresjolyst merged 1 commit intodevelopmentfrom
fix/nordpool-datetime-format
Apr 21, 2026
Merged

fix: handle MM/dd/yyyy HH:mm:ss date format from NordPool API#111
sondresjolyst merged 1 commit intodevelopmentfrom
fix/nordpool-datetime-format

Conversation

@sondresjolyst
Copy link
Copy Markdown
Owner

NordPool started returning delivery dates in MM/dd/yyyy HH:mm:ss format instead of ISO 8601, causing a FormatException that crashed both the daily background fetch job and the electricity prices endpoint. Added ParseDeliveryDate() helper that handles all three formats NordPool may return, and brings in the same timezone-safe UTC midnight storage from main to prevent duplicate rows.

NordPool started returning delivery dates in 'MM/dd/yyyy HH:mm:ss' format
instead of ISO 8601, causing a FormatException in ParseDeliveryDate.

Added ParseDeliveryDate() helper (aligned with the main-branch timezone fix)
that handles all three formats NordPool may return:
- ISO with T (e.g. 2026-04-18T22:00:00Z) - parsed as UTC via DateTimeOffset
- MM/dd/yyyy HH:mm:ss (new NordPool format) - stored as UTC midnight
- yyyy-MM-dd (date-only) - stored as UTC midnight

This prevents both the FormatException and timezone-dependent duplicate rows,
and fixes both the background fetch job and the controller endpoint.
@sondresjolyst sondresjolyst force-pushed the fix/nordpool-datetime-format branch from c9b00b8 to 7218d5c Compare April 21, 2026 06:38
@sondresjolyst sondresjolyst merged commit 97a29bb into development Apr 21, 2026
1 check passed
@sondresjolyst sondresjolyst deleted the fix/nordpool-datetime-format branch April 21, 2026 06:44
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