Skip to content

2b. Configuration:Calendar

Seongnoh Sean Yi edited this page Dec 19, 2018 · 6 revisions

Calendar

Example

calendars : [
  {
    name: "US holiday",
    icon: "noto-beach-with-umbrella",
    className: "holiday",
    url: "http://www.calendarlabs.com/templates/ical/US-Holidays.ics",
  },
  {
    name : "Tottenham",
    icon: "noto-soccer-ball",
    replaceTitle:[
      ["Tottenham Hotspur", ""],
      [" - ", ""]
    ],
    className: "Tottenham",
    url: "https://www.google.com/calendar/ical/ovb564thnod82u5c4njut98728%40group.calendar.google.com/public/basic.ics",
  },
],

calendars:[] could have at least ONE (and more) calendar to get events. Each calendar should have url. If you want to use local .ics file, put into MM directory and can contact it with "https://localhost:8080/YOUR.ics".

Default values of calendar

Below fields are predefined values. Unless overriding it, this will be used by default.

{
  url: "",
  name: "",
  maxItems: 100,
  scanInterval: 1000*60*30,
  beforeDays: 60,
  afterDays: 365,
  maxIterations: 100,
  forceLocalTZ: false,
  replaceTitle:[],
  icon: "",
  className: "",
  auth: {},
  filter: (event)=>{return true}
}
  • url : REQUIRED URL of .ics
  • name : OPTIONAL BUT RECOMMENDED name of this calendar. This value will be used in view to pick up specific calendar.
  • maxItems : how much events should be parsed.
  • scanInterval : (milliseconds) how often calendar should be rescanned.
  • beforeDays, afterDays : Events between these days will be got.
  • maxIterations: If event is recurrent type, how many recurrence will be parsed.
  • forceLocalTZ : Some iCal has wrong time zone information. When the iCal has that kind of problem, this option could be a simple fix.
  • replaceTitle : Array of [pattern, replace].
    • e.g)
replaceTitle:[
  ["Tottenham Hotspurs", "SPURS"],
  [" - ", " vs "]
],

With this configuration, event title "Totten Hotspurs - FC. Arsenal" will be changed to "SPURS vs FC. Arsenal".

pattern could be the RegExp and replace could be result of RegExp. In below example, event title "Thanks God Its Friday" will be replaced as "TGIF"

replaceTitle:[
  ["/([A-Z])([a-z]+ ?)/g", "$1"]
],
.CX2 .event.myClass {
  color:#FF0;
  background-color:#333;
}
  • auth : If your calendar needs additional info, use it.
auth: {
  method: "bearer",
  pass: "yourpassword",
}

or 

auth: {
  method: "digest",
  user: "yourusername",
  pass: "yourpasword"
}
  • filter : You can filter events with this callback function.
    • By Example, below code makes only to include events which title is "WORK".
filter: (event) => {
  if (event.title == "WORK") return true
}

Available Event properties, See Event Object.

You can’t perform that action at this time.