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

How do I configure it to select previous dates not next dates? #13

Open
3atharvkurdukar opened this issue Jul 10, 2021 · 1 comment
Open

Comments

@3atharvkurdukar
Copy link

Hi, I tried to use your library for my admin dashboard. However, I am unable to configure it to show dates of previous 30 days from today, but no date in the future.
Providing negative value to endDate prop didn't work. So I tried to copy the code and modify it on my own, but could not do so. If I somehow try to change the startDate to anything previous to the current date, it renders nothing. Please help.

@3atharvkurdukar
Copy link
Author

Okay, I was able to pinpoint the issue. It arises when the startDate and lastDate have a difference of less than 30 days and the startDate and lastDate are in different months. This causes the for loops to malfunction in some way. The culprit might be this line:

end = i === differenceInMonths(lastDate, startDate)
  ? Number(format(lastDate, 'd'))
  : Number(format(lastDayOfMonth(month), 'd'));

How do I fix this? I tried some solutions, but it stucks in another way.

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

1 participant