Skip to content

[Bug Report][3.6.7] Wrong calculation of the calendar week in date composable #20490

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

Closed
ChristianMaehler opened this issue Sep 18, 2024 · 0 comments · Fixed by #21199
Closed
Assignees
Labels
C: VDatePicker T: bug Functionality that does not work as intended/expected
Milestone

Comments

@ChristianMaehler
Copy link

Environment

Vuetify Version: 3.6.7
Vue Version: 3.4.23
Browsers: Chrome 128.0.0.0
OS: Mac OS 10.15.7

Steps to reproduce

use a v-date-picker, display calendar week and navigate to December 2024

Expected Behavior

The week starting the 30th of December should be week 1 not week 53

Actual Behavior

Week 53 is dispayed instead of week 1

Reproduction Link

https://play.vuetifyjs.com/#...

Other comments

I guess it's a bug in the getWeek function in https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/composables/date/date.ts

I tried this function also and it returns 53.

According to the ISO standard it should be week 1: https://en.wikipedia.org/wiki/ISO_week_date

"...
First week
The ISO 8601 definition for week 01 is the week with the first Thursday of the Gregorian year (i.e. of January) in it. The following definitions based on properties of this week are mutually equivalent, since the ISO week starts with Monday:

It is the first week with a majority (4 or more) of its days in January.
Its first day is the Monday nearest to 1 January.
It has 4 January in it. Hence the earliest possible first week extends from Monday 29 December (previous Gregorian year) to Sunday 4 January, the latest possible first week extends from Monday 4 January to Sunday 10 January.
It has the year's first working day in it, if Saturdays, Sundays and 1 January are not working days.
..."

Also performed a Wolfram Alpha search: https://www.wolframalpha.com/input?input=what+is+the+date+of+the+first+week+of+2025

There is a working implementation here: https://gist.github.com/vincentorback/8edffeca20e7a9e5e2a6?permalink_comment_id=1769808 and some more info here https://stackoverflow.com/questions/58708417/why-is-1-added but I don't know whether you can use this code (licence?).

@github-actions github-actions bot added the S: stale This issue is untriaged and hasn't seen any activity in at least six months. label Mar 18, 2025
@github-actions github-actions bot removed the S: stale This issue is untriaged and hasn't seen any activity in at least six months. label Mar 23, 2025
@johnleider johnleider added this to the v3.7.x milestone Apr 1, 2025
@johnleider johnleider added T: bug Functionality that does not work as intended/expected and removed S: triage labels Apr 1, 2025
@KaelWD KaelWD modified the milestones: v3.7.x, v3.8.x Apr 1, 2025
@J-Sek J-Sek self-assigned this Apr 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: VDatePicker T: bug Functionality that does not work as intended/expected
Projects
None yet
5 participants