Skip to Content
⚠️Active Development Notice: TimeTiles is under active development. Information may be placeholder content or not up-to-date.

web


web / lib/utils/event-detail

lib/utils/event-detail

Utility functions for extracting and formatting event detail data.

Pure helper functions used by the EventDetailContent component and its child components for data extraction, type coercion, and display formatting.

Interfaces

EventData

Type for event data object

Indexable

[key: string]: unknown

Properties

title?

optional title: string

name?

optional name: string

description?

optional description: string

startDate?

optional startDate: string

endDate?

optional endDate: string

city?

optional city: string

country?

optional country: string

Functions

safeToString()

safeToString(value): string

Safely convert an unknown value to a string, returning empty string for unsupported types

Parameters

value

unknown

Returns

string


getEventData()

getEventData(event): EventData

Extract the data object from an event, handling non-object or array cases

Parameters

event
data

unknown

Returns

EventData


getEventTitle()

getEventTitle(eventData): string

Get event title from data, falling back to name then “Untitled Event”

Parameters

eventData

EventData

Returns

string


getDatasetInfo()

getDatasetInfo(dataset): { name: string; id: number; } | null

Extract dataset name and ID from a dataset relation value

Parameters

dataset

unknown

Returns

{ name: string; id: number; } | null


formatDateRange()

formatDateRange(startDate, endDate): string | null

Format start/end dates into a human-readable range string

Parameters

startDate

unknown

endDate

unknown

Returns

string | null


getLocationDisplay()

getLocationDisplay(event, eventData): string | null

Build a location display string from event and data fields

Parameters

event

object | Record<string, unknown>

eventData

EventData

Returns

string | null


hasValidCoordinates()

hasValidCoordinates(location): boolean

Check whether an event has valid (non-zero) coordinates

Parameters

location

{ latitude?: number \| null; longitude?: number \| null; } | null | undefined

Returns

boolean

Last updated on