Add a basic eventDataTransform function to clean up event names

This commit is contained in:
Adam Goldsmith 2020-03-16 22:55:47 -04:00
parent 3a6890e3cb
commit 2fd3a06a40

View File

@ -14,6 +14,7 @@ import googleCalendarPlugin from '@fullcalendar/google-calendar';
import '@fullcalendar/core/main.css';
import '@fullcalendar/daygrid/main.css';
import '@fullcalendar/timegrid/main.css';
import { EventInput } from '@fullcalendar/core';
const calendars: { [key: string]: string } = {
computer_lab: '6mmjp85e4732ru6skf1dda54ls@group.calendar.google.com',
@ -44,6 +45,7 @@ export default class App extends Vue {
return {
googleCalendarId: id,
color: colors.pop(),
eventDataTransform: this.eventDataTransform,
};
}),
slotLabelFormat: {
@ -57,6 +59,14 @@ export default class App extends Vue {
hour12: false,
},
};
eventDataTransform(eventData: EventInput): EventInput {
const match = eventData.title.match(/([^\/]*) \/ ([^-]*) - (.*)/);
if (match !== null) {
eventData.title = match[3];
}
return eventData;
}
}
</script>