Skip to content
fullcalendar.js 767 B
Newer Older
import { Calendar } from '@fullcalendar/core';
import dayGridPlugin from '@fullcalendar/daygrid';
import timeGridPlugin from '@fullcalendar/timegrid';
import listPlugin from '@fullcalendar/list';
import allLocales from '@fullcalendar/core/locales-all';

/* eslint-disable-next-line import/prefer-default-export */
Andreas Klöckner's avatar
Andreas Klöckner committed
export function setupCalendar(domEl, events, initialDate, locale) {
  const calendar = new Calendar(domEl, {
    plugins: [
      dayGridPlugin,
      timeGridPlugin,
      listPlugin,
    ],
    locales: allLocales,
    initialView: 'dayGridMonth',
    headerToolbar: {
      left: 'prev,next today',
      center: 'title',
      right: 'dayGridMonth,timeGridWeek,listWeek',
    },
    initialDate,
    events,
Andreas Klöckner's avatar
Andreas Klöckner committed
    locale,
  });
  calendar.render();
}