-
-
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
operate on strings instead of Date objects #2109
operate on strings instead of Date objects #2109
Conversation
…accepting only strings
Please try to add comments throughout the code. There seems to be quite a bit of code to handle specific Date quirks. |
There'a lot of changed code because it used the Date object thorough the all component and now it uses the string representation. I'll add some comments though, it was needed even before this PR |
const day = (this.normalizeDate(this.tableYear, this.tableMonth).getDay() - parseInt(this.firstDayOfWeek) + 7) % 7 | ||
|
||
// Use UTC time zone to get the position of the first day of the month relative to the first day of the week | ||
const day = (new Date(`${this.tableYear}-${this.tableMonth + 1}-01 GMT+0`).getUTCDay() - parseInt(this.firstDayOfWeek) + 7) % 7 |
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 isn't very readable. I would suggest breaking it out into a separate function
Hi @jacekkarczmarczyk |
0.17-beta with this patch is coming very soon |
cool, thank you. 👍 |
if I need next format DD/MM/YYYY in v-model with a slash, How can I implement it ? |
You can't use formatted value as a model, it accepts only ISO format. You may format it on your own using |
Besides solving the problem with time zones on Chrome/OSX it also introduces few minor breaking changes:
dateFormat
andformattedValue
props - settingdateFormat
prop only to send a function to Vuetify, call it and get the result back doesn't make sense to me, dev can just run the formatting function by himself on the modelvalue
,allowedDates
etc must be strings inYYYY-MM-DD
orYYYY-MM
formatFixes #2022
Fixes #2173