Premium support for our pure JavaScript UI components


Post by Samith »

I need to keep the startDate and endDate along with the centerDate, but in the docs you mentioned that if both start and end dates are provided then it ignores the centerDate,
att.png
att.png (52.8 KiB) Viewed 648 times
I have a requirement to have this exact condition with having all 3 config, it works fine only with start/end or center date
useEffect(() => {
    if (!preset) return;
    const zoomLevels = preset.zoomLevels;
    getSchedulerInstance().zoomLevels = zoomLevels;

    getSchedulerInstance().zoomToLevel(preset.selectedZoomIndex, {
      startDate: new Date(2019, 8, 1, 6),
      endDate: new Date(2019, 11, 1, 6),
      centerDate: new Date() // need point to the today's date 
    });

    // getSchedulerInstance().scrollToDate(new Date());
  }, [preset]);
do you have a workaround for this, I tried below snippets and they are not working as expected
getSchedulerInstance().scrollToNow()
getSchedulerInstance().scrollToDate(new Date());

Post by Samith »

Any update on this please?

Post by sergey.maltsev »

Hi, Samith!

You could calculate start and end dates according to centerDate and delta value.
const
    centerDate = new Date(),
    deltaDays = 3;
scheduler.startDate = DateHelper.add(centerDate, -deltaDays, 'day');
scheduler.endDate = DateHelper.add(centerDate, deltaDays, 'day');
Could you please describe what exactly you want as a result?

Post Reply