Agent-readable demo data

Title
White CSS Theme (Open-Source JavaScript Monthly Event Calendar) | DayPilot Lite for JavaScript Demo
Tree
DayPilot JavaScript Demo
Catalog root
Lite
Description
Note: You can create a theme using the online DayPilot Theme Designer: https://themes.daypilot.org/

Inline demo script 1

var dp = new DayPilot.Month("dp");

    // behavior and appearance
    dp.theme = "month_white";

    // view
    dp.startDate = "2026-03-01";

    // generate and load events
    for (var i = 0; i < 10; i++) {
        var duration = Math.floor(Math.random() * 1.2);
        var start = Math.floor(Math.random() * 6) - 3; // -3 to 3

        var e = new DayPilot.Event({
            start: new DayPilot.Date("2026-03-04T00:00:00").addDays(start),
            end: new DayPilot.Date("2026-03-04T12:00:00").addDays(start).addDays(duration),
            id: DayPilot.guid(),
            text: "Event " + i
        });
        dp.events.add(e);
    }

    // event creating
    dp.onTimeRangeSelected = function (args) {
        var name = prompt("New event name:", "Event");
        dp.clearSelection();
        if (!name) return;
        var e = new DayPilot.Event({
            start: args.start,
            end: args.end,
            id: DayPilot.guid(),
            text: name
        });
        dp.events.add(e);
    };

    dp.onEventClicked = function(args) {
        alert("clicked: " + args.e.id());
    };

    dp.contextMenu = new DayPilot.Menu({
        items: [
            {
                text: "Edit...",
                onClick: async args => {
                    const form = [
                        {id: "text", name: "Event Name", type: "text"}
                    ];
                    const e = args.source;
                    const modal = await DayPilot.Modal.form(form, e.data);
                    if (modal.canceled) {
                        return;
                    }
                    dp.events.update(modal.result);
                }
            },
            {text: "-"},
            {
                text: "Delete",
                onClick: args => {
                    dp.events.remove(args.source);
                }
            }
        ]
    });

    dp.onBeforeEventRender = args => {
        args.data.areas = [
            {
                right: 2,
                top: 2,
                width: 20,
                height: 20,
                padding: 2,
                symbol: "../icons/daypilot.svg#threedots-v",
                action: "ContextMenu"
            }
        ]
    };



    dp.init();