ShowtimeList and ShowtimesWithDatePicker components display movie showtimes with various grouping options. Both components share the same core functionality but ShowtimesWithDatePicker includes an interactive horizontal date picker.
ShowtimeList
A simple showtime display component that groups showtimes by date.Props
Array of showtime objects. Each showtime must include:
start_time: ISO datetime stringscreen_type: Screen format (e.g., “2D”, “3D”, “IMAX”)movie_url: Booking URL (optional)cinema: Cinema object (ifshowCinemais true)movie: Movie object (ifshowMovieis true)
When
true, groups showtimes by cinema and displays cinema name and location for each groupWhen
true, groups showtimes by movie and displays movie title for each groupUsage
Show showtimes grouped by date only
Group by cinema (on movie detail page)
Group by movie (on cinema detail page)
ShowtimesWithDatePicker
An enhanced version with a horizontal scrollable date picker at the top.Props
Array of showtime objects. Same structure as
ShowtimeListWhen
true, groups showtimes by cinema within each dateWhen
true, groups showtimes by movie within each dateFeatures
- Interactive date picker: Horizontal scrollable date buttons showing day, date, and month
- Active state: First date is selected by default, shows accent color
- Click to switch: Clicking a date button shows showtimes for that date
- Astro page transitions: Works correctly with Astro’s view transitions
- Custom scrollbar: Hides scrollbar for cleaner look while maintaining scroll functionality
Usage
On movie detail page (group by cinema)
On cinema detail page (group by movie)
Grouping Behavior
Both components support three grouping modes:- Date only (default): Groups showtimes by date, shows all showtimes in a flat list
- Date + Cinema: Groups by date, then by cinema. Shows cinema name and location as subheaders
- Date + Movie: Groups by date, then by movie. Shows movie title as subheaders
Only set one of
showCinema or showMovie to true. Setting both will show cinemas and hide movies.Screen Type Display
Both components show screen types (3D, IMAX, etc.) next to the showtime in parentheses. 2D is the default and is not displayed.Booking Links
If a showtime has amovie_url, the time button becomes a clickable link that opens in a new tab. Otherwise, it displays as plain text.
Styling
Both components use Tailwind CSS and rely on these theme variables:bg-primary: Background for showtime buttons (ShowtimeList)bg-secondary: Background for cards and default showtime buttonsbg-accent: Active date button and hover statestext-accent: Link hover colortext-gray-400: Secondary text for locations and metadata
JavaScript Behavior (ShowtimesWithDatePicker only)
The component includes an inline script that:- Initializes on page load and after Astro page transitions
- Handles date button clicks to switch between date views
- Updates button styles to show active state
- Shows/hides corresponding showtime content
Utility Functions
Both components use these utility functions fromsrc/lib/utils.ts:
groupShowtimesByDate(): Groups showtimes array by dateformatShowtime(): Formats time as “7:00 PM”formatDate(): Formats full date (ShowtimeList only)formatDayShort(): Formats day as “Mon”, “Tue”, etc.formatDayNum(): Extracts day number (e.g., “15”)formatMonthShort(): Formats month as “Jan”, “Feb”, etc.slugify(): Creates URL-friendly slugs