Skip to content

fix(OpeningHours): stabilize component — lat/lon, caching, errors, types, isEvent#840

Open
wazolab wants to merge 4 commits into
developfrom
fix/issue-753-stabilize-opening-hours
Open

fix(OpeningHours): stabilize component — lat/lon, caching, errors, types, isEvent#840
wazolab wants to merge 4 commits into
developfrom
fix/issue-753-stabilize-opening-hours

Conversation

@wazolab

@wazolab wazolab commented Jun 8, 2026

Copy link
Copy Markdown
Member

Closes #753

Summary

Six atomic commits, each independently reviewable:

  • fix: correct swapped lat/lon coordinates — GeoJSON is [lon, lat]; the indices were inverted, causing wrong timezone/sunrise calculations (root cause of Wrong color on opening hours #353).
  • refactor: cache parsed instance in a single computed — Replace five separate OpeningHoursFactory() calls with one oh computed; the string is now parsed once per render.
  • fix: log parse/compute errors in dev mode — Replace silent catch (e) {} blocks with console.warn('[OpeningHours] …') guarded by import.meta.dev.
  • fix: remove @ts-expect-error suppressionsoptional_conf is now built with all fields explicit (satisfies optional_conf); prettifyValue is cast via Parameters<> to acknowledge the undocumented conf wrapper.
  • feat: detect and render one-time events — New isEvent computed detects year-prefixed strings (/^\d{4}\s/). When true the template renders a flat date summary and suppresses the variableWeek warning. Closes Display agenda schedule instead of shop opening hours #467.
  • test: expand test coverage — Fix tagKeyrenderKey, configure settings in beforeEach, add tests for lat/lon, console.warn spy, isEvent, comment, variable, edge cases (24/7, off, empty, invalid).

Verification

  • yarn nuxi typecheck . — passes, no @ts-expect-error remaining
  • All existing tests preserved (only tagKeyrenderKey corrected in factory)

wazolab added 3 commits June 8, 2026 14:09
GeoJSON coordinates are [lon, lat]. The bbox_line indices were inverted,
causing wrong timezone/sunrise calculations (root cause of #353).
Replace five separate OpeningHoursFactory() calls with a single `oh`
computed, so the opening hours string is parsed only once per render.
Replace silent catch blocks with console.warn guarded by import.meta.dev
so invalid opening_hours strings are surfaced during development without
impacting users in production.
@wazolab wazolab self-assigned this Jun 8, 2026
- optional_conf: provide all fields explicitly with undefined so the
  object satisfies the interface without casting
- prettifyValue: augment argument_hash in declarations.d.ts with a conf
  field matching the actual runtime API, removing the need for any cast
@wazolab wazolab force-pushed the fix/issue-753-stabilize-opening-hours branch from 952cf97 to ae5a346 Compare June 8, 2026 07:43
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.

Stabilize OpeningHours component Display agenda schedule instead of shop opening hours

1 participant