Agent-readable demo data

Title
Highlighting Today (Open-Source JavaScript Event Calendar) | DayPilot Lite for JavaScript Demo
Tree
DayPilot JavaScript Demo
Catalog root
Lite
Description
Note: This demo uses the onBeforeCellRender event to highlight today's cells with a light yellow color. Read more about Calendar cell customization.

Inline demo script 1

const dp = new DayPilot.Calendar("dp", {
            viewType: "Week",
            startDate: DayPilot.Date.today(),
            // headerDateFormat: "dddd",
            onTimeRangeSelected: async args => {

                const form = [
                    {name: "Name", id: "text"}
                ];

                const data = {
                    text: "Event"
                };

                const modal = await DayPilot.Modal.form(form, data);

                dp.clearSelection();

                if (modal.canceled) {
                    return;
                }

                dp.events.add({
                    start: args.start,
                    end: args.end,
                    id: DayPilot.guid(),
                    text: modal.result.text,
                    barColor: "#3c78d8"
                });
            },
            onBeforeCellRender: args => {
                if (args.cell.start.getDatePart() === DayPilot.Date.today()) {
                    args.cell.properties.backColor = "#fff8e1";
                }
            }
        });
        dp.init();

        const app = {
            init() {
                this.loadEvents();
            },
            loadEvents() {
                const events = [
                ];
                dp.update({events});
            }
        };
        app.init();