search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

onTimeRangeSelected(args) not passing values

Asked by Mike
8 years ago.

This is actually a Day Pilot for JavaScript question. I'm using the Day Pilot JavaScript API to create a calenda,r and I'd like to be able to create a new event by selecting a time range on the calendar. I used the example from this link but when I try to use args.start inside my event creating function, I get "undefined".

Answer posted by Dan Letecky [DayPilot]
8 years ago.

The client-side event-handling API has two modes that can be switched using .api property:

All DayPilot versions that include an integrated server-side part (ASP.NET WebForms, MVC, Java) use .api=1. These versions will support api=2 in the near future but at this moment you can only use api=1 (api=2 will break the event handlers set from the server side).

You should check the bottom of the API doc page for the api=1 syntax:

The standalone JavaScript version uses .api=2 by default and the following example will work. It is copied from the demo at

    dp.onTimeRangeSelected = function (args) {
        var name = prompt("New event name:", "Event");
        if (!name) return;
        var e = new DayPilot.Event({
            start: args.start,
            end: args.end,
            id: DayPilot.guid(),
            resource: args.resource,
            text: name
This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.