Hooked up calendar viewing to API, still needs a lot more polish
This commit is contained in:
36
shared/types/calendar.ts
Normal file
36
shared/types/calendar.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
export interface CalendarEvent {
|
||||
id: number;
|
||||
name: string;
|
||||
start: Date;
|
||||
end: Date;
|
||||
location: string;
|
||||
color: string;
|
||||
description: string;
|
||||
creator_id: number;
|
||||
cancelled: boolean;
|
||||
created_at: Date;
|
||||
updated_at: Date;
|
||||
|
||||
creator_name?: string | null;
|
||||
eventSignups?: CalendarSignup[] | null;
|
||||
}
|
||||
|
||||
export enum CalendarAttendance {
|
||||
Attending = "attending",
|
||||
NotAttending = "not_attending",
|
||||
Maybe = "maybe"
|
||||
}
|
||||
|
||||
export interface CalendarSignup {
|
||||
memberID: number;
|
||||
eventID: number;
|
||||
state: CalendarAttendance;
|
||||
}
|
||||
|
||||
export interface CalendarEventShort {
|
||||
id: number;
|
||||
name: string;
|
||||
start: Date;
|
||||
end: Date;
|
||||
color: string;
|
||||
}
|
||||
11
shared/utils/time.ts
Normal file
11
shared/utils/time.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export function toDateTime(date: Date): string {
|
||||
// This produces a CST-local time because server runs in CST
|
||||
const year = date.getFullYear();
|
||||
const month = (date.getMonth() + 1).toString().padStart(2, "0");
|
||||
const day = date.getDate().toString().padStart(2, "0");
|
||||
const hour = date.getHours().toString().padStart(2, "0");
|
||||
const minute = date.getMinutes().toString().padStart(2, "0");
|
||||
const second = date.getSeconds().toString().padStart(2, "0");
|
||||
|
||||
return `${year}-${month}-${day} ${hour}:${minute}:${second}`;
|
||||
}
|
||||
Reference in New Issue
Block a user