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

Get the current date?

Asked by Chris Kachinsky
25 days ago.

Hi there. I'm trying to use the scheduler and the navigator together. I have them working nicely, allowing me to move through dates.

I've been reading about the navigator and the events.list - but I'm struggling to get it working at present. I'm trying to just write a js function to get the json for the events in the current month, but how do I get the date we're currently looking at?

If I open the console and type `dp.dp.startDate.value` - I get a reply with the correct date, but for some reason I cannot do this automatically. Even with a setTimeout, it still doesn't work...

Any ideas?

Thanks, Chris

Answer posted by Dan Letecky [DayPilot]
25 days ago.

If you want to get the date that was last clicked in the Navigator, you can read the selectionDay property:

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

const current = nav.selectionDay;

If you use selectMode other than "Day", you can use selectionStart and selectionEnd to get the full selected range:

To read the date range currently displayed by the Navigator, you can use visibleStart() and visibleEnd():

The visibleStart() method returns the date in the top-left corner and the visibleEnd() method returns the date in the bottom-right corner. You can use these methods if you want to load the free/busy data (to be assigned to events.list).

Please let me know if this is not what you are looking for.

Answer posted by Chris Kachinsky
22 days ago.

Thanks Dan.

New Reply
This reply is
Your name (optional):