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

operate on strings instead of Date objects #2109

Merged
merged 19 commits into from
Oct 16, 2017

Conversation

jacekkarczmarczyk
Copy link
Member

@jacekkarczmarczyk jacekkarczmarczyk commented Oct 9, 2017

Besides solving the problem with time zones on Chrome/OSX it also introduces few minor breaking changes:

  • removes dateFormat and formattedValue props - setting dateFormat 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 model
  • all input/output values are strings, value, allowedDates etc must be strings in YYYY-MM-DD or YYYY-MM format

Fixes #2022
Fixes #2173

@nekosaur
Copy link
Member

Please try to add comments throughout the code. There seems to be quite a bit of code to handle specific Date quirks.

@jacekkarczmarczyk
Copy link
Member Author

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
Copy link
Member

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

@jacekkarczmarczyk jacekkarczmarczyk changed the title [WIP] operate on strings instead of Date objects operate on strings instead of Date objects Oct 12, 2017
@johnleider johnleider added this to the v1.0.0 milestone Oct 12, 2017
@jacekkarczmarczyk jacekkarczmarczyk merged commit c9e0196 into vuetifyjs:dev Oct 16, 2017
@jacekkarczmarczyk jacekkarczmarczyk added S: needs docs update The change requires an update to the documentation and removed S: needs docs update The change requires an update to the documentation labels Oct 16, 2017
@CasperLaiTW
Copy link

Hi @jacekkarczmarczyk
Is any plan to release about this patch?

@jacekkarczmarczyk
Copy link
Member Author

0.17-beta with this patch is coming very soon

@jacekkarczmarczyk jacekkarczmarczyk deleted the fix/date-picker-tz branch October 24, 2017 14:37
@CasperLaiTW
Copy link

cool, thank you. 👍

@snevgasymov
Copy link

snevgasymov commented Nov 9, 2017

if I need next format DD/MM/YYYY in v-model with a slash, How can I implement it ?

@jacekkarczmarczyk
Copy link
Member Author

You can't use formatted value as a model, it accepts only ISO format. You may format it on your own using momentjs or similiar libs or your own formatter
For any questions please visit official discord channel https://chat.vuetifyjs.com

@KaelWD KaelWD modified the milestones: v1.0.0, v0.17.x Nov 16, 2017
@lock
Copy link

lock bot commented Apr 15, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Please direct any non-bug questions to our Discord

@lock lock bot locked as resolved and limited conversation to collaborators Apr 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants