Agent-readable demo data

Title
RTL (JavaScript Event Calendar) | DayPilot Pro for JavaScript Demo
Tree
DayPilot JavaScript Demo
Catalog root
Default
Description
Read more about the RTL event calendar [doc.daypilot.org].

Inline demo script 1

const dp = new DayPilot.Calendar("dp", {
            showAllDayEvents: true,
            startDate: DayPilot.Date.today(),
            viewType: "Week",
            rtl: true,
            onTimeRangeSelected: async args => {
                const modal = await DayPilot.Modal.prompt("New event name:", "Event");
                if (modal.canceled) {
                    return;
                }
                dp.events.add({
                    start: args.start,
                    end: args.end,
                    id: DayPilot.guid(),
                    resource: args.resource,
                    text: modal.result // Assuming that the event text should be the user input
                });
                dp.clearSelection();
                dp.message("Created");
            }
        });
        dp.init();

        const nav = new DayPilot.Navigator("nav", {
            selectMode: "week",
            onTimeRangeSelect: args => {
                console.log("args", args);
                dp.update({startDate: args.start});
            },
            rtl: true
        });
        nav.init();


        const app = {
            init() {
                this.loadEventData();
            },
            loadEventData() {
                const events = [
                    {
                        start: DayPilot.Date.today().firstDayOfWeek().addDays(1).addHours(12),
                        end: DayPilot.Date.today().firstDayOfWeek().addDays(1).addHours(15),
                        id: DayPilot.guid(),
                        text: "Event 1"
                    },
                    {
                        start: DayPilot.Date.today().firstDayOfWeek().addDays(1).addHours(16),
                        end: DayPilot.Date.today().firstDayOfWeek().addDays(1).addHours(18),
                        id: DayPilot.guid(),
                        text: "Event 2"
                    },
                ];
                dp.update({events});
            }
        };
        app.init();