Skip to content

Cut months and days at Dublin midnight and show Dublin time - #51

Merged
baz8080 merged 2 commits into
mainfrom
claude/eager-sagan-wn68lr
Sep 24, 2026
Merged

baz8080 merged 2 commits into
mainfrom
claude/eager-sagan-wn68lr

Conversation

@baz8080

@baz8080 baz8080 commented Sep 24, 2026 •

Copy link
Copy Markdown
Owner

The follow-up to #48. Every month, day cell, gate date and printed time on the site was UTC, and none of it said so. From April to October, every time a reader saw was an hour behind ESB's own: an outage ESB lists at 15:15 read "began 14:15". A fault at 00:30 on the 1st, Irish time, was counted in the previous month.

The rule is store and compute in UTC, display in local time. lifts made the same fix on 2026-08-18.

What changed

  • Buckets. month_bounds, month_list, partial_days, the per-day split and the day cells in county_month now cut at Dublin midnight. Each boundary is converted back to a UTC instant (model.midnight), because subtracting two datetimes that share a zone loses the hour at a clock change. Every window and customer-minute sum still runs on UTC. The cell count comes from calendar.monthrange (a Dublin March is 23 h short).
  • Display. Case records stay UTC, so the durations, estimate deltas and horizon comparison keep subtracting UTC strings, unchanged. Only printed times are converted: render._local, and its mirror local() in site.html, which uses Intl.DateTimeFormat with timeZone: "Europe/Dublin". On an engine without zone data it falls back to UTC rather than failing to render. The payload shape doesn't change. This departs from the plan to follow lifts' approach of shipping Dublin wall-clock strings with precomputed durations: that approach is only needed when the record itself is local time.
  • Dates and stamps.
    • Dates in Dublin: the gate date ("Grades appear from ..."), the month table's "from/to" caveat, the "Data to ..." hover title (which no longer says UTC), and the sitemap lastmod.
    • Unchanged: generated keeps statusui's shared UTC stamp, and the CSV keeps its *_utc columns.
  • Payload. A new observed_month gives the Dublin month for the "so far" wording.
  • Accepted edge. In the repeated hour when the clocks go back in October, an outage can read "began 01:50 · restored 01:10 (20 min)". The span is correct; the wall-clock times read backwards for one hour a year.

Documented in notes/grading.md § Months and days are Dublin's (2026-09-24), with a CLAUDE.md Settled row.

What moves on the site

Built from esb-data to the 24 September horizon, main against this branch. No grade letter moves.

  • Day cells shift by up to an hour's worth of outage in 13 county-months.
  • Dublin's customer minutes lost: August 12.0 → 11.9, September 10.2 → 10.3. National September 11.9 → 12.0.
  • One Monaghan fault that began just before midnight on 31 July, Irish time, moves from July into August. Monaghan's August restored-in-4-h goes 99.5 → 98.9 and its first-estimate share 58.3 → 60.0. July, now under two observed hours, is empty.

Tests

  • 16 tests that pinned UTC were updated. Ten are case-copy tests whose hand-made UTC records now print an hour later in summer.
  • New tests cover:
    • a UTC day that is the next day in Dublin;
    • a winter time, which is unchanged;
    • a span across the October clock change, which reads correctly;
    • the month list turning over at 23:30 UTC on the 31st;
    • a Dublin last day;
    • day cells in March, October and February.
  • A code review agent run on this PR showed that several conversions could be reverted to UTC with every test still passing: the per-day key, the timeline row, the caveat dates, observed and observed_month. Each now has a test that fails when it is reverted; the per-day key and the timeline row were checked by reverting them. CI runs no JS, so the page's call sites are held by a text test.
  • Browser check: in Chromium with the browser set to New York, all 856 Dublin and Cork records render the same summary line and timeline times from the JS as from render.py, with no page errors.

Checks

  • ruff check: clean.
  • unittest discover with ESB_DATA_DIR set: 308 tests OK.
  • The full site builds; initial load is 68.1 KB of the 500 KB budget.

Review findings not taken

  • Move the conversion into statusui. lifts ships Dublin wall-clock strings and would not use a shared UTC-to-Dublin wrapper. uisce would, once it moves to Dublin months, so this is a question for that change.
  • Converting the start once per row. Taken in caseHtml. The remaining whenAt conversions are a few per row and not worth threading a second argument through for.

🤖 Generated with Claude Code

https://claude.ai/code/session_01UqWuH6frirpbQDKnF5rEdT

Every month, day cell, gate date and printed time was UTC and unlabelled, so
through the summer each time a reader saw was an hour behind ESB's own, and
a fault at 00:30 on the 1st counted in the previous month.

Boundaries are now Dublin midnights held as UTC instants, so every window
and customer-minute sum still runs on UTC; day cells come from
calendar.monthrange. Case records stay UTC, so durations and estimate
deltas keep subtracting UTC, and only printed times turn Dublin, through
render._local and its site.html mirror on Intl with timeZone Europe/Dublin.
The observed hover title is Dublin; observed_month is new for the "so far"
wording.

No grade letter moves on the corpus to 24 September. Checked in Chromium
set to New York: 856 records render identically from JS and Python.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UqWuH6frirpbQDKnF5rEdT
Review of this PR showed the per-day key, the timeline row, the caveat
dates, observed and observed_month could each revert to UTC with every test
still passing; each now has a test that fails when it does, and the JS
mirror's call sites are held by a text test since CI runs no JS. Also:
- a page on an engine without zone data falls back to UTC times instead of
  failing to render at all
- the sitemap lastmod is Dublin's date
- the start is converted once per row in caseHtml
- comments no longer restate the rule the note settles
- July under Dublin months holds under two hours, not three
- the note records the October repeated hour as an accepted edge

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UqWuH6frirpbQDKnF5rEdT
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.

2 participants