feat(FE): crud show, handle date timezones
This commit is contained in:
parent
95fa9fd742
commit
37a3d1a457
2 changed files with 43 additions and 33 deletions
|
@ -1,17 +1,21 @@
|
|||
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[] => {
|
||||
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
|
||||
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 [];
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue