Agent-readable demo data
- Title
- Lunch Break (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 mark the lunch break as non-business time.
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.getHours() === 12) {
args.cell.properties.business = false;
}
}
});
dp.init();
const app = {
init() {
this.loadEvents();
},
loadEvents() {
const events = [
];
dp.update({events});
}
};
app.init();