Mohammad Zaman
Mohammad Zaman

Reputation: 3

How to change number of days language in Fullcalendar

anyone help me how to change the custom number of days in hebrew language Fullcalendar see image here

Upvotes: 0

Views: 773

Answers (1)

Uzair
Uzair

Reputation: 136

FullCalendar has a dayCellDidMount option in Day-Cell Render Hooks, which is triggered after the day cell is mounted. https://fullcalendar.io/docs/day-cell-render-hooks

You can replace the day text with any custom text using this option.

var calendar = new FullCalendar.Calendar(calendarEl, {
    ...
    dayCellDidMount: function (info) {
        var day = moment(info.date).locale('hu').format('DD'); // Get the localized date; hu is for hebrew here. You can use like 'en', 'de'
        // Hide the original element
        var originElement = info.el.querySelectorAll(".fc-daygrid-day-number");
        originElement.forEach(e => e.classList.add("d-none"));
        //Insert custom or localized text 
        var targetElement = info.el.querySelectorAll(".fc-daygrid-day-top");
        targetElement.forEach(e => e.innerHTML = day);
    }

});

Upvotes: 2

Related Questions