Get current date boundaries

Hello.

How can I get the date boundaries of the current view?
I know there is the currentDate, but how do I get the start and end date of the current view?
Is it possible to get these values when a user changes the view type as well?

Thanks!

1 Reply

BS Balasubramanian Sattanathan Syncfusion Team April 29, 2020 08:36 AM UTC

Hi Florian Mihalits, 

Greetings from Syncfusion Support. 

We have validated your requirement “Get current date boundaries” at our side and prepared a sample based on that using create and actionComplete event like below code snippet. We can get current date boundaries by using below code snippet. 

function onCreate() { 
                currentDates(); 
function onActionComplete(args) { 
if (args.requestType === "dateNavigate" || args.requestType === "viewNavigate") { 
                currentDates(); 
function currentDates() { 
                var schObj = $('#Schedule1').ejSchedule('instance'); 
                var startDate = new Date(schObj.dateRender[0]); 
                var endDate = new Date(schObj.dateRender[schObj.dateRender.length -1]) 
                console.log("Start date is "+ startDate); 
                console.log("End date is "+ endDate); 


Kindly try the above sample and let us know if you need further assistance. 

Regards, 
Balasubramanian S

Loader.
Up arrow icon