import type {ShowInstance} from "@models/show/showInstance.ts"; import type {calendarShowEvent} from "@models/misc/calendarShowEvent.ts"; import {convertToUserTimezoneDate} from "@/helpers/DateFormatter.ts"; export const setShowInstancesForCalendar = (showInstances: ShowInstance[]): calendarShowEvent[] => { if(showInstances.length > 0){ return showInstances.flatMap((showInstance: ShowInstance, index: number) => { return { showInstanceIndex: index, showInstanceId: showInstance.id, title: showInstance.show.name, color: '#'+showInstance.show.backgroundColor, start: convertToUserTimezoneDate(showInstance.starts), end: convertToUserTimezoneDate(showInstance.ends), timed: true } } ); } return []; }