-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
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
fix(VDatePicker): weeknumber calculation refactored to fix bug #10926
fix(VDatePicker): weeknumber calculation refactored to fix bug #10926
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.
Need to clean up the code styling. I'm surprised it passed lint. More information is located in our Coding Guidelines.
I applied all coding guidelines I could find in the document. I could not find tslint or eslint configuration to make sure I found all the issues. |
@johnleider Travis CI had problems yesterday can you trigger a rebuild? Or is this not needed? |
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.
Could it be done without using the Date object? I remember it's having some problems on ios/osx and with different time zones.
Some magic numbers (like 604800000) could be turned into a constant with a meaningful name and written as a product of some better recognized values (for example 86400 = 24(hrs) * 60(min) * 60(src))
Last but not least method could be extracted to helpers so it could be tested wihtout involving all the component
@jacekkarczmarczyk Please leave that in a review. |
packages/vuetify/src/components/VDatePicker/VDatePickerDateTable.ts
Outdated
Show resolved
Hide resolved
packages/vuetify/src/components/VDatePicker/VDatePickerDateTable.ts
Outdated
Show resolved
Hide resolved
packages/vuetify/src/components/VDatePicker/VDatePickerDateTable.ts
Outdated
Show resolved
Hide resolved
packages/vuetify/src/components/VDatePicker/VDatePickerDateTable.ts
Outdated
Show resolved
Hide resolved
packages/vuetify/src/components/VDatePicker/util/__tests__/determineWeeknumber.spec.ts
Outdated
Show resolved
Hide resolved
packages/vuetify/src/components/VDatePicker/util/determineWeeknumber.ts
Outdated
Show resolved
Hide resolved
packages/vuetify/src/components/VDatePicker/util/determineWeeknumber.ts
Outdated
Show resolved
Hide resolved
packages/vuetify/src/components/VDatePicker/util/determineWeeknumber.ts
Outdated
Show resolved
Hide resolved
packages/vuetify/src/components/VDatePicker/util/determineWeeknumber.ts
Outdated
Show resolved
Hide resolved
packages/vuetify/src/components/VDatePicker/util/determineWeeknumber.ts
Outdated
Show resolved
Hide resolved
packages/vuetify/src/components/VDatePicker/util/determineWeeknumber.ts
Outdated
Show resolved
Hide resolved
Instead of calculating only the weeknumber for the first week shown and increment it, it is now calcuted for every week. fix vuetifyjs#9764
a19f255
to
6ba059b
Compare
packages/vuetify/src/components/VDatePicker/VDatePickerDateTable.ts
Outdated
Show resolved
Hide resolved
Number(this.firstDayOfWeek) | ||
) % 7 // https://en.wikipedia.org/wiki/Zeller%27s_congruence | ||
return Math.floor((dayOfYear + offset) / 7) + 1 | ||
getWeekNumber (dayInMonth: 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.
Re-format this similar to:
return weekNumber(
arg1,
arg2,
arg3,
)
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.
First argument is on its own line
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.
This was meant for line 69
Instead of calculating only the weeknumber for the first week shown and increment it, it is now
calcuted for every week.
fix #9764
Description
fixes #9764
Motivation and Context
#9764
How Has This Been Tested?
unit | visually
Markup:
Types of changes
Checklist:
master
for bug fixes and documentation updates,dev
for new features and backwards compatible changes andnext
for non-backwards compatible changes).