Documentation v8.0.25

Preview Purchase
Fullcalendar is the most popular Javascript Calendar. It's powerful and lightweight and suitable for just about anything. For more info see the official siteand the Github repository.

Local JS Timezone Example

Fullcalendar's example with timezones with local JS logic. For more info on server side logic, please visit the official documentation.
var initialTimeZone = "local";
var timeZoneSelectorEl = document.getElementById("kt_docs_fullcalendar_timezone_selector");
var calendarEl = document.getElementById("kt_docs_fullcalendar_timezone");
var todayDate = moment().startOf("day");
var YM = todayDate.format("YYYY-MM");
var YESTERDAY = todayDate.clone().subtract(1, "day").format("YYYY-MM-DD");
var TODAY = todayDate.format("YYYY-MM-DD");
var TOMORROW = todayDate.clone().add(1, "day").format("YYYY-MM-DD");
var eventsArray = [
    ...
];

// Initialize the external events -- for more info please visit the official site: https://fullcalendar.io/demos
var calendar = new FullCalendar.Calendar(calendarEl, {
    timeZone: initialTimeZone,
    headerToolbar: {
        left: "prev,next today",
        center: "title",
        right: "dayGridMonth,timeGridWeek,timeGridDay,listWeek"
    },
    initialDate: TODAY,
    navLinks: true, // can click day/week names to navigate views
    editable: true,
    selectable: true,
    dayMaxEvents: true, // allow "more" link when too many events

    eventTimeFormat: { hour: "numeric", minute: "2-digit", timeZoneName: "short" },
    events: eventsArray,
});

calendar.render();

// when the timezone selector changes, dynamically change the calendar option
// --- more info on Select2 on Change event: https://select2.org/programmatic-control/events
$(timeZoneSelectorEl).on("change", function () {
    calendar.setOption("timeZone", "UTC");

    // Remove all events
    const removeEvents = calendar.getEvents();
    removeEvents.forEach(event => {
        event.remove();
    });

    // Add events with new timezone offset
    const newEvents = eventsArray;
    newEvents.forEach(event => {
        var start;
        var end;

        if(this.value < 0){
            start = moment(event.start).subtract(this.value.replace(/\D/g,""), "seconds").format(getFormat(event.start));
            end = event.end ? moment(event.end).subtract(this.value.replace(/\D/g,""), "seconds").format(getFormat(event.end)) : start;
        } else {
            start = moment(event.start).add(this.value, "seconds").format(getFormat(event.start));
            end = event.end ? moment(event.end).add(this.value, "seconds").format(getFormat(event.end)) : start;
        }

        calendar.addEvent({
            title: event.title,
            start: start,
            end: end
        });
    });

    calendar.render();
});

// Dynamic date format generator
const getFormat = (d) => {
    if(d.includes("T")){
        return "YYYY-MM-DDTHH:mm:ss";
    } else {
        return "YYYY-MM-DD";
    }
}
<!--begin::Localization dropdown-->
<div class="mb-5">
    <label class="fs-4 fw-bolder mb-3">Select a Timezone:</label>
    <select id="kt_docs_fullcalendar_timezone_selector" class="form-select mw-200px" data-control="select2" data-placeholder="Select an option">
        ...
    </select>
</div>
<!--end::Localization dropdown-->

<!--begin::Fullcalendar-->
<div id="kt_docs_fullcalendar_timezone"></div>
<!--end::Fullcalendar-->

Explore Metronic

Demo1

Demo2

Demo3

Demo4

Demo5

Demo6

Demo7

Demo8

Demo9

Demo10

demo
Coming soon

Demo11

Demo12

demo
Coming soon

Demo13

Demo14

demo
Coming soon

Demo15

demo
Coming soon

Demo16

demo
Coming soon

Demo17

demo
Coming soon

Demo18

demo
Coming soon

Demo19

demo
Coming soon

Demo20

demo
Coming soon