deseretdigital / dayzed

Primitives to build simple, flexible, WAI-ARIA compliant React date-picker components.
https://dayzed.netlify.app
MIT License
660 stars 27 forks source link

Offset -1 not working with getBackProps and getForwardProps #54

Open StKostyantin opened 1 year ago

StKostyantin commented 1 year ago

When you create a calendar in a range style. By default, it will show the current month and the next month. But if you want to show the last month and the current month, you need to set offset-1

For example.

onst dayzedData = useDayzed({
    onDateSelected: handleOnDateSelected,
    selected: selectedDates,
    offset: -1,
    monthsToDisplay: 2,
    firstDayOfWeek: 1,
    date: new Date(),
    showOutsideDays: true,
  });

And it displays fine, but the onClick with getBackProps and getForwardProps stop working

mkartchner994 commented 1 year ago

When offset is passed as a prop it becomes controlled and will needed to be handled by you using the onOffsetChanged prop. Here are links to read more about it.

https://github.com/deseretdigital/dayzed#onoffsetchanged https://github.com/deseretdigital/dayzed#control-props