17 lines
694 B
TypeScript
17 lines
694 B
TypeScript
import type {ShowInstance} from "@models/show/showInstance.ts";
|
|
import type {calendarShowEvent} from "@models/misc/calendarShowEvent.ts";
|
|
|
|
export const setShowInstancesForCalendar = (showInstances: ShowInstance[]): calendarShowEvent[] => {
|
|
return showInstances.flatMap((showInstance: ShowInstance, index: number) => {
|
|
return {
|
|
showInstanceIndex: index,
|
|
showInstanceId: showInstance.id,
|
|
title: showInstance.show.name,
|
|
color: showInstance.show.color,
|
|
start: new Date(showInstance.starts),
|
|
end: new Date(showInstance.ends),
|
|
timed: true
|
|
}
|
|
}
|
|
);
|
|
}
|