Premium support for our pure JavaScript UI components


Post by snath »

Hi Team,

We are listening for the beforeTaskEdit event call in order to show our custom popup. We display the startDate and the endDate using event.taskRecord.data.startDate and event.taskRecord.data.endDate. But this I believe is set to "day" as the window is always 24hours. Is there a way to set this to "hour" so that the window is 1 hour?

Currently using Scheduler Pro 5.2.1.

Thanks!
Suhan Nath


Post by tasnim »

Hello,

But this I believe is set to "day" as the window is always 24hours. Is there a way to set this to "hour" so that the window is 1 hour?

Sorry, I don't understand properly what you want to achieve. Could you please show you're code and explain a bit more?

We display the startDate and the endDate using event.taskRecord.data.startDate and event.taskRecord.data.endDate

event.taskRecord.data.startDate and event.taskRecord.data.endDate is not going to give you the updated result. You should be using event.taskRecord.startDate and event.taskRecord.endDate


Post by snath »

Hi Tasnim,

Following is the code we are using.

 beforeTaskEdit: event => {
          const startDate = event.taskRecord.startDate;
          const endDate = event.taskRecord.endDate;
          //Opening custom popup with data
          this.$refs.editActivityModal.setResourceRecord(
            event.taskRecord.resource,
            startDate,
            endDate  
); }

Here startDate and endDate are for example 01/26/2023 - 10:00 AM and 01/27/2023 10:00AM. (A 24 hour window).

We would like this window to be a 1 hour window(01/26/2023 - 10:00AM to 01/26/2023 - 11:00AM). That is what I meant that the durationUnit might be 1 day.

Thanks!
Suhan Nath


Post by alex.l »

HI Suhan,

if you copied start/end dates with 24 hour difference, the duration will be 24 hours.
To have 1 hour duration, use another endDate, with 1 hour difference.
You also can omit endDate and fill in https://bryntum.com/products/schedulerpro/docs/api/SchedulerPro/model/EventModel#field-duration and https://bryntum.com/products/schedulerpro/docs/api/SchedulerPro/model/EventModel#field-durationUnit
In this case endDate will be calculated automatically according to startDate and duration

All the best,
Alex


Post Reply