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

BUG: Wrong week number displayed, only after having selected a date range #475

Open
JPCrounse opened this issue Feb 20, 2019 · 5 comments
Open
Labels
Status: needs triage Issue has not been properly analyzed yet.

Comments

@JPCrounse
Copy link

Here is a jsfiddle demonstrating this issue: https://jsfiddle.net/vhfrqtk6/1/

The issue can be replicated when selecting a date range starting in March 2019 and ending in April of 2019.
When the picker is subsequently re-opened, the first week of April (week 14) displays as week 13.

This only seems to happen after a date range has been selected.
Prior to selection the correct week number is displayed.

Here is a screen shot displaying the issue: https://imgur.com/a/Ngxb6nN

Best regards,
JP

@JPCrounse JPCrounse changed the title Wrong week number displayed, only after having selected a date range BUG: Wrong week number displayed, only after having selected a date range Feb 27, 2019
@monovertex monovertex added the Status: needs triage Issue has not been properly analyzed yet. label Nov 5, 2019
@hbulens
Copy link

hbulens commented Jun 25, 2020

If you're using moment, then getWeekNumber: (day) => moment(day).isoWeek() seems to do the trick.

@holtkamp
Copy link
Collaborator

Same goes for the first three days of 2020.

image_2021_01_26T16_38_05_520Z

These days officially belong to week "2020-53" according to ISO week dates

Screenshot 2021-01-26 at 17 46 56

So #475 (comment) might be a viable approach...

@JPCrounse
Copy link
Author

If you're using moment, then getWeekNumber: (day) => moment(day).isoWeek() seems to do the trick.

This works but the code seems to use the first day of the week to determine the week number, so in case you're using Sunday as the start of the week you'll have to use this instead: getWeekNumber: (day) => moment(day).add(1, 'd').isoWeek()

@holtkamp
Copy link
Collaborator

holtkamp commented Jul 7, 2021

possibly related: #376

@monovertex maybe we should use the "ISO week" approach as suggested by #475 (comment) as default option to align with overviews like http://www.whatweekisit.org

And then maybe do a check for which start of the week was used (Sunday or Monday) as suggested by #475 (comment)

@dlk1932
Copy link

dlk1932 commented Mar 4, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: needs triage Issue has not been properly analyzed yet.
Projects
None yet
Development

No branches or pull requests

5 participants