2

I am trying to make my own header using "titleFormat" as method. It works for "timeGridWeek" and "dayGridMonth" but doesn't work for another two views with resource.

titleFormat(date){
    date.end.marker.setDate(date.end.marker.getDate() - 1)

    if(this.$refs.fullCalendar.getApi().state.viewType === 'timeGridWeek') {
      return ` ${date.date.marker.toLocaleDateString("default", {day: "2-digit"})} -
        ${date.end.marker.toLocaleDateString("default", {day: "2-digit"})}
        ${date.date.marker.toLocaleDateString("default", { month: "long" })}`
    }
    else if(this.$refs.fullCalendar.getApi().state.viewType === 'dayGridMonth'){
      return date.date.marker.toLocaleDateString("default", { month: "long" });
    }
    else if(this.$refs.fullCalendar.getApi().state.viewType === 'resourceTimeGridDay'){
      return date.date.marker.toLocaleDateString("default", { month: "short" });
    }
  }

I am checking in which view i am now and depends on that i return another content. My third condition is for "resourceTimeGridDay" and i fall into it but everything that I return from there is not used and just ignored.

Could you please assist?

Denys
  • 283
  • 2
  • 11

1 Answers1

1

According to fullcalendar support, better to use datesRender() hook for that. And it really works.

Denys
  • 283
  • 2
  • 11