Our powerful JS Calendar component


Post by Animal »

That is just some JS code using the Date class: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date

Getting The first date in a month from the date variable:

new Date(date.getFullYear(),date.getMonth(), 1);

Getting The last date in a month from the date variable:

new Date(date.getFullYear(),date.getMonth() + 1, -1);

But be aware what you mean by "last date". Remember a Date is a timestamp, not a 24 hour block.


Post by tornikezhizh »

thank you but I think it won't help me, because I wouldn't know what is date variable in my case, because it contains dates from previous and next months also


Post by Animal »

How don't you know? What application operation are you attempting to create? Show some code.


Post by tornikezhizh »

I have some field where I show total working hours, for day it's 8 hours, for week it is 8 * working days in that week, but for month view it's incorrect since I don't have correct start and end date. I have dateRangeChange event handler and I am sending ajax request to server from that event Handler.

calendar.crudManager.encoder = {
                requestData: {
                    userID: empid,
                    startDate: event.new.startDate,
                    endDate: event.new.endDate
                }
            };

        calendar.crudManager.load();

Post by Animal »

I showed you how to get the start date of a month for any date.

Calendar has the date: https://www.bryntum.com/products/calendar/docs/api/Calendar/view/Calendar#property-date


Post by tornikezhizh »

thanks it is helpful now, but problem is when I change view from week to month, in that eventHandler, calendar.mode is still week , not month. How can I capture this? or what event does view change fires?


Post by Animal »


Post Reply