-
-
Notifications
You must be signed in to change notification settings - Fork 7k
fix(VDatePicker): use start of week to calculate week numbers #21199
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure to check #20794 as I think some of the changes might effect your P.R.
If we decide to trust [
{code: 'US', intlCode: 'en-US'},
{code: 'FR', intlCode: 'fr'},
{code: 'PL', intlCode: 'pl'},
// etc...
]
.map(({code, intlCode}) => {
const {firstDay, minimalDays} = new Intl.Locale(intlCode).getWeekInfo()
return `'${code}': { firstDay: ${firstDay}, minimalDays: ${minimalDays} },`
})
.join('\n') |
Ok, this PR was wrong in the state when |
@johnleider this PR can be merged instead of #20794 once we resolve changes to
Options:
|
0769fea
to
f768a6b
Compare
Glad I had this test case for Portugal. It was incorrectly assigned during refactoring. |
What changes are left for firstDay? |
None, all reverted. Hard to prove after refactoring into the concise switch though.. You'd need a script probably const firstDay = {
'001': 1,
AD: 1,
// etc.
}
console.log('codes for 0', Object.entries(firstDay).filter((_,v) => v === 0).map(([k,_]) => k).sort().join(' '))
console.log('codes for 1', Object.entries(firstDay).filter((_,v) => v === 1).map(([k,_]) => k).sort().join(' '))
console.log('codes for 6', Object.entries(firstDay).filter((_,v) => v === 6).map(([k,_]) => k).sort().join(' ')) |
@@ -37,6 +37,7 @@ export interface DateAdapter<T = unknown> { | |||
getDiff (date: T, comparing: T | string, unit?: string): number | |||
getWeekArray (date: T, firstDayOfWeek?: number | string): T[][] | |||
getWeekdays (firstDayOfWeek?: number | string): string[] | |||
getWeek (date: T, firstDayOfWeek?: number | string, firstWeekMinSize?: number): number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that I added new arguments to some of the typings but it was probably the wrong move. We need to figure out a way to get this information without needing to change the interface.
Sounds like we should just be using ISO rules for week of year https://unicode-org.atlassian.net/browse/CLDR-18275 |
We could, but I can only see this being rolled out in Vuetify if we also let users opt-out with |
One last fix.. hopefully. I just realized when clicking on the playground - after choosing non-us locale, selecting |
Description
fixes #20724
fixes #20490
ISO-ish 4-day requirement for the first weekdefaults to matchen-US
Markup: