DayPilot.Month.events.add

The events.add() method adds a new event to the monthly calendar component.

Declaration

DayPilot.Month.events.add(e[, data]);

Parameters

  • e (DayPilot.Event or a raw data object) - item to be created

  • data (object) - custom data to be sent to the server side with the Notify event (ASP.NET WebForms, ASP.NET MVC, and Java versions only)

Return Value

Returns a DayPilot.Action object that stores the action details.

Notes

You can pass either a DayPilot.Event instance or a raw event data object.

When you provide the optional data parameter, it is sent to the server with the Notify event in ASP.NET WebForms, ASP.NET MVC, and Java versions.

Example

Create a new event:

const event = {
  start: DayPilot.Date.today(),
  end: DayPilot.Date.today().addDays(1),
  text: "New calendar event",
  id: 1,
};

dp.events.add(event);

See Also

DayPilot.Event Class

Client-Side Event API [doc.daypilot.org]

DayPilot.Month Class

Availability

Availability of this API item in DayPilot editions:

LitePro
DayPilot for JavaScript