# Monthly Event Calendar | DayPilot Pro for JavaScript Demo

> The height is set to 100% of the parent element. Read more about the setting the monthly event calendar control [height to 100%](https://doc.daypilot.org/month/100-pct-height/) [doc.daypilot.org].

## Links

- Canonical HTML: /demo/month/100pctheight.html
- Source HTML folder: /demo/month/
- Catalog root: /demo/
- Catalog: /demo/llms.txt

## Source

### Inline demo script 1

```javascript
const dp = new DayPilot.Month("dp", {
            heightSpec: "Parent100Pct",
            onTimeRangeSelected: async args => {
                const modal = await DayPilot.Modal.prompt("New event name:", "Event");
                dp.clearSelection();
                if (modal.canceled) return;
                dp.events.add({
                    start: args.start,
                    end: args.end,
                    id: DayPilot.guid(),
                    text: modal.result
                });
                dp.message("Created");
            }
        });
        dp.init();

        const app = {
            loadData() {
                const events = [];
                let start = DayPilot.Date.today().firstDayOfMonth();
                for (let i = 0; i < 15; i++) {
                    const add = Math.floor(Math.random() * 2);
                    // const add = 1;
                    start = start.addDays(add);
                    if (start.getDayOfWeek() === 6) {
                        start = start.addDays(2);
                    }
                    if (start.getDayOfWeek() === 0) {
                        start = start.addDays(1);
                    }

                    events.push({
                        start: start,
                        end: start.addDays(1),
                        id: DayPilot.guid(),
                        text: "Event " + (i + 1)
                    });
                }
                dp.update({events});
            },
        };
        app.loadData();
```

