Skip to content

Disabling days does not work as expected when used with "weekStartsOn" option #237

Open
@boopalanjayaraman

Description

Hi,

Let me start by saying how much I like react infinite calendar and how useful this has turned out to be. This is a life saver.

There is a minor issue here. Disabling days using "disabledDays" attribute does not work well with "weekStartsOn" attribute. Without the latter, it works fine.

I wanted to disable the weekend dates, so I initially wrote it as disabledDays = {[0, 6]} corresponding to sun and sat days. And then I wanted my week to start on Monday, so I had added

locale={{
        weekStartsOn: 1
      }}

This does change the week's starting day but enables clicking on sundays. It does not fully disable them, and the click eventhandler is triggered.

Try this with having locale attribute on and off.


return (
    <InfiniteCalendar
      disabledDays={[0, 1, 2, 3, 4, 5, 6]}
      locale={{
        weekStartsOn: 1
      }}
    />
  );

You can see it happening in the given sandbox.

https://codesandbox.io/s/modest-sinoussi-6s85o?file=/src/index.js:263-305

Thanks.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions