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

Get day select in DayPilot Navigator

Asked by Anonymous
4 years ago.

Hi all,

could you help to get "Day select in DayPilot Navigator ?

I would like add an button to send event like this :

<input type=button id="email" onClick="location.href='email_event.php?date=2020-04-17'" value='Email Event'>

Thanks for your help

Comment posted by Anonymous
4 years ago.

i found this on forum

You can get the current selection using the following properties:
* nav.selectionDay - the exact day that was clicked

but i can't find the good synthaxe to implement in this code
<input type=button id="email" onClick="location.href='email_event.php?date=2020-04-17'" value='Email Event'>

Best regard

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

Yes, you can use selectionDay:

https://api.daypilot.org/daypilot-navigator-selectionday/

If you have a Navigator instance called "nav":

var nav = new DayPilot.Navigator("...");
// ...

you can read the value like this:

<input type=button id="email" onClick="location.href='email_event.php?date=' + nav.selectionDay" value='Email Event'>

It will be automatically converted to full ISO 8601 date/time format without timezone spec, e.g. "2020-04-17T00:00:00".

You can get custom text format using toString():

<input type=button id="email" onClick="location.href='email_event.php?date=' + nav.selectionDay.toString('yyyy-MM-dd')" value='Email Event'>

There are also two more properties which may have different values than selectionDay if the selectMode is set to "week" or "month":

https://api.daypilot.org/daypilot-navigator-selectionstart/
https://api.daypilot.org/daypilot-navigator-selectionend/

Comment posted by Anonymous
4 years ago.

Perfect Dan,

thanks

This question is more than 1 months old and has been closed. Please create a new question if you have anything to add.