João Victor
João Victor

Reputation: 639

fullcalendar format dayGrid day cell to show month and day

I want to show the day of each cell as the "month day" I've already try to use slotLabelFormat, and all the others slotLabel, but any of those worked. The picture below is how I did using JS, but when I perform any action on the calendar, it got a refresh and render the default, which is only the dayenter image description here

enter image description here

Upvotes: 0

Views: 1845

Answers (2)

João Victor
João Victor

Reputation: 639

Solved! I added the dayRender method like this:

dayRender(eventInfo){
 if(eventInfo.view.type === 'dayGridMonth'){
  return eventInfo.el.innerHTML = moment(eventInfo.el.dataset.date, 'YYYY-MM-DD').format('MMM DD');
 }
}

and this on my CSS

.fc-day-number{
    visibility: hidden;
}

Upvotes: 2

Daniel H
Daniel H

Reputation: 61

There is a page on how to customize with your own Javascript:

https://fullcalendar.io/docs/custom-view-with-js

Specifically, there is

renderDates(dateProfile) { // responsible for rendering the given dates }

and more steps on how to accomplish a more customized view. Hope this helps!

Upvotes: 1

Related Questions