Get all future showtimes for a specific movie, including cinema details. Results are ordered by start time.
Parameters
The unique identifier of the movie
Returns
showtimes
Promise<Array<Showtime & { cinema: Cinema }>>
Array of showtime objects with embedded cinema data
Unique identifier for the showtime
ID of the movie being shown
ID of the cinema showing the movie
ISO 8601 timestamp of when the showtime starts
Type of screen (e.g., “Standard”, “IMAX”, “3D”)
Link to the cinema’s booking page for this showing
ISO timestamp when the showtime was created
ISO timestamp when the showtime was last updated
Full cinema object (see Cinema Queries for details)
Example
import { getShowtimesForMovie } from '@/lib/queries';
const showtimes = await getShowtimesForMovie(123);
showtimes.forEach((showtime) => {
console.log(`${showtime.cinema.name} - ${showtime.start_time}`);
console.log(`Screen: ${showtime.screen_type}`);
if (showtime.movie_url) {
console.log(`Book: ${showtime.movie_url}`);
}
});
Implementation
Uses Supabase to join showtimes with cinema data and filter for future times:
const now = new Date().toISOString();
const { data, error } = await supabase
.from('showtimes')
.select(`
*,
cinema:cinemas(*)
`)
.eq('movie_id', movieId)
.gte('start_time', now)
.order('start_time');
getShowtimesForCinema()
Get all future showtimes for a specific cinema, including movie details. Results are ordered by start time.
Parameters
The unique identifier of the cinema
Returns
showtimes
Promise<Array<Showtime & { movie: Movie }>>
Array of showtime objects with embedded movie data
Unique identifier for the showtime
ID of the movie being shown
ID of the cinema showing the movie
ISO 8601 timestamp of when the showtime starts
Type of screen (e.g., “Standard”, “IMAX”, “3D”)
Link to the cinema’s booking page for this showing
ISO timestamp when the showtime was created
ISO timestamp when the showtime was last updated
Full movie object (see Movie Queries for details)
Example
import { getShowtimesForCinema } from '@/lib/queries';
const showtimes = await getShowtimesForCinema(5);
showtimes.forEach((showtime) => {
console.log(`${showtime.movie.title} - ${showtime.start_time}`);
console.log(`Screen: ${showtime.screen_type}`);
if (showtime.movie_url) {
console.log(`Book: ${showtime.movie_url}`);
}
});
Implementation
Uses Supabase to join showtimes with movie data and filter for future times:
const now = new Date().toISOString();
const { data, error } = await supabase
.from('showtimes')
.select(`
*,
movie:movies(*)
`)
.eq('cinema_id', cinemaId)
.gte('start_time', now)
.order('start_time');
Working with Showtimes
Date Filtering
Both showtime query functions automatically filter for future showtimes by comparing against the current timestamp:
const now = new Date().toISOString();
// Only returns showtimes where start_time >= now
Booking Links
The movie_url field contains direct links to cinema booking pages when available:
const showtimes = await getShowtimesForMovie(movieId);
const bookableShowtimes = showtimes.filter(st => st.movie_url);
// Redirect user to booking page
window.location.href = bookableShowtimes[0].movie_url;
Screen Types
The screen_type field indicates the viewing format. Common values include:
- “Standard” - Regular screening
- “IMAX” - Large format screen
- “3D” - Three-dimensional presentation
- “4DX” - Motion seats and environmental effects
- “Dolby Cinema” - Enhanced audio/visual
const iMaxShowtimes = showtimes.filter(
st => st.screen_type.includes('IMAX')
);