Skip to content

fix(phantasialand): read the calendar from the page's data stream - #716

Open
BeyondVertical wants to merge 1 commit into
ThemeParks:mainfrom
BeyondVertical:fix/phantasialand-calendar-datastream
Open

BeyondVertical wants to merge 1 commit into
ThemeParks:mainfrom
BeyondVertical:fix/phantasialand-calendar-datastream

Conversation

@BeyondVertical

Copy link
Copy Markdown
Contributor

Problem

The Phantasialand schedule page was rebuilt as a Next.js page and no longer carries a data-calendar attribute. getCalendarJSON() finds no attribute and returns [], so buildSchedules() gets no events and the park reports no opening hours.

Change

  • The calendar now sits in the page's data stream: self.__next_f.push([1,"..."]) calls whose texts, joined, form lines <id>:<json>. The line with "blockType":"calendar-block" holds calendarData (label id with day ranges) and colorLegendLabels (id and name).
  • New parseCalendar(html) reads that block and returns the same {title, days_selected} events as before, so buildSchedules() is unchanged. An unreadable or missing block gives [] with a warning, as before.
  • The English page (the one parksapi fetches) now writes titles like Wintertraum: 11 a.m. – 08 p.m. with a dash instead of until. None of the three 12-hour patterns in parseHours() matched that, so those days would still have dropped out. They are now one pattern that accepts until or a dash.

Tests

New src/parks/phantasialand/__tests__/calendar.test.ts (four tests) with a trimmed copy of the real stream: events and days per label, a day range across a month end, the dash form of the hours, and a page without a calendar block.

Checked against the live English page: 143 days, 76 park opening days, 66 Wintertraum days and New Year's Eve.

tsc, the pre-commit hooks and the tests of the park folders pass.

🤖 Generated with Claude Code

The schedule page no longer carries a data-calendar attribute. The calendar
now sits in the Next.js data stream (self.__next_f.push calls) as a
calendar-block with calendarData and colorLegendLabels. getCalendarJSON()
found no attribute and returned an empty list, so no opening hours came out.

parseCalendar() reads the stream and returns the same {title, days_selected}
events as before, so buildSchedules() is unchanged.

The English page now writes times like "11 a.m. – 08 p.m." with a dash
instead of "until". parseHours() takes both with one 12-hour pattern.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>

This branch has not been deployed

No deployments
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