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

Wrong week number displayed #692

Closed
ghost opened this issue Apr 12, 2018 · 4 comments
Closed

Wrong week number displayed #692

ghost opened this issue Apr 12, 2018 · 4 comments

Comments

@ghost
Copy link

ghost commented Apr 12, 2018

Hello,

When the prop "showWeekNumbers" is equal to "true", the week numbers displayed are wrong.

For example, for the 12th april 2018, the week number displayed is "14" while we should see "15" (see here).

I made a sandbox with the behavior : https://codesandbox.io/s/xr4ovz55qo

image
image

Thanks in advance

@moag1000
Copy link

moag1000 commented Apr 13, 2018

I was wondering why it didn't do the same thing in my live example. Finally found out why.

The link also says:
"Week number according to the ISO-8601 standard, weeks starting on Monday". If you do that (firstDayOfWeek={1} ), the week number shows up correctly.

edit: just to point out: I'm not telling you to change the first day of week. It's just an addition to say that US users are affected.

@gpbl
Copy link
Owner

gpbl commented Apr 13, 2018

I'm not sure if this has something to do with the firstDayOfTheWeek.

For what I see after a quick debug, this line where we take week[0] (as the first day of the week row) gets the Jan. 1st from the previous year. It should instead get the first day of the week of the current year. This should be easily fixable...

@gpbl
Copy link
Owner

gpbl commented Apr 13, 2018

mmm the above seems a different bug 🙄

gpbl added a commit that referenced this issue Apr 14, 2018
@gpbl gpbl closed this as completed in #693 Apr 14, 2018
gpbl added a commit that referenced this issue Apr 14, 2018
* Use last day of the week to get the week number

Fixes #692

* Fix unit test

* Fix rendering unit test
@gpbl
Copy link
Owner

gpbl commented Apr 14, 2018

The fix has been published in v7.1.5. Please report back if you have some feedback, thanks!

kimamula pushed a commit to kimamula/react-day-picker that referenced this issue Aug 17, 2022
* Use last day of the week to get the week number

Fixes gpbl#692

* Fix unit test

* Fix rendering unit test
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