Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
boopalanjayaraman opened this issue Sep 15, 2020 · 1 comment

Comments

@boopalanjayaraman
Copy link

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.

@scsskid
Copy link

scsskid commented Oct 19, 2020

disabledDays={[0, 1, 2, 3, 4, 5, 6, 7]}

seems to work, while disabledDays={[1, 2, 3, 4, 5, 6, 7]} leaves nov 1st enabled, but sundays disabled 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants