date-fns internally for date formatting.
formatShowtime
Formats a datetime string to display just the time in 12-hour format.ISO 8601 datetime string to format
Time formatted as “h:mm a” (e.g., “7:30 PM”)
date-fns functions parseISO() and format() with pattern 'h:mm a'
formatDate
Formats a datetime string to display a short date with day of week.ISO 8601 datetime string to format
Date formatted as “EEE, MMM d” (e.g., “Fri, Mar 15”)
date-fns functions parseISO() and format() with pattern 'EEE, MMM d'
formatFullDate
Formats a datetime string to display the complete date in long format.ISO 8601 datetime string to format
Date formatted as “EEEE, MMMM d, yyyy” (e.g., “Friday, March 15, 2024”)
date-fns functions parseISO() and format() with pattern 'EEEE, MMMM d, yyyy'
formatDayShort
Formats a datetime string to display just the abbreviated day of week.ISO 8601 datetime string to format
Day formatted as “EEE” (e.g., “Fri”)
date-fns functions parseISO() and format() with pattern 'EEE'
formatDayNum
Formats a datetime string to display just the day number.ISO 8601 datetime string to format
Day number formatted as “d” (e.g., “15”)
date-fns functions parseISO() and format() with pattern 'd'
formatMonthShort
Formats a datetime string to display just the abbreviated month name.ISO 8601 datetime string to format
Month formatted as “MMM” (e.g., “Mar”)
date-fns functions parseISO() and format() with pattern 'MMM'
formatDuration
Formats a duration in minutes to a human-readable string.Duration in minutes, or null
Formatted duration string (e.g., “2h 15m”, “90m”, “2h”) or empty string if minutes is null or 0
- Returns empty string if
minutesis null or falsy - Returns “m” if less than 60 minutes (e.g., “45m”)
- Returns “h” if exactly divisible by 60 (e.g., “2h”)
- Returns “h m” otherwise (e.g., “2h 15m”)
formatRating
Formats a rating number to one decimal place.Rating value, or null
Rating formatted to 1 decimal place (e.g., “7.5”) or empty string if rating is null
slugify
Converts text into a URL-friendly slug.Text to convert to a slug
URL-friendly slug with lowercase letters, numbers, and hyphens only
- Converts to lowercase
- Replaces non-alphanumeric characters with hyphens
- Removes leading and trailing hyphens