-
-
Notifications
You must be signed in to change notification settings - Fork 403
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
confirm: value doesn't change on "OK", if only year and/or month were changed #290
Comments
v2.11.0 added <date-picker @select-year="handleSelectYear" @select-month="handleSelectMonth" v-model="value" lang="en" ></date-picker> handleSelectYear (year) {
if (this.value) {
this.value = new Date(new Date(this.value).setFullYear(year))
}
},
handleSelectMonth (month) {
if (this.value) {
this.value = new Date(new Date(this.value).setMonth(month))
}
} |
@mengxiong10 Thank you for the quick reaction and adding the Is it a deliberate design decision that the value doesn't already change once a different year is selected (see screenshots taken here) using the default configuration ( |
Yes, Because the prop |
I understand. In case where Looking again at the API, it might actually be sufficient for my case to listen for (The Update: Actually we use <date-picker v-model="value" confirm /> |
@mengxiong10 FYI I have added the example with |
The |
If I select a year and then click the |
If I add PS: An |
If you need to confirm the |
I respect that you don't agree, so I'm closing this issue and will suggest your proposed solution/workaround in nextcloud-libraries/nextcloud-vue#137. PS: I still think it's a pity that I need to handle two events and call a method on the instance to get a behaviour that I would expect by default (being consistent with the UX of other datepickers). For example, Android's DatePicker allows setting a |
Let me add: |
@mengxiong10 Unfortunately, there is a problem with your suggested workaround: If year and month are changed in one go, only the month is changed upon confirmation:
Do you have a tip how to fix this? |
handleSelectYear(year) {
let value = this.$refs.datepicker.currentValue;
if (value) {
value = new Date(new Date(value).setFullYear(year));
this.$refs.datepicker.selectDate(value);
}
},
handleSelectMonth(month) {
let value = this.$refs.datepicker.currentValue;
if (value) {
value = new Date(new Date(value).setMonth(month));
this.$refs.datepicker.selectDate(value);
}
} |
Thanks a lot, @mengxiong10. |
I added a prop |
The month and year of a date cannot currently be changed alone (using the UI).
Steps to reproduce
<date-picker v-model="value" confirm />
Expected result
It should be possible to change ...
Actual result
The changes are ignored unless day or month and day are chosen.
The text was updated successfully, but these errors were encountered: