-
Notifications
You must be signed in to change notification settings - Fork 18
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
Value is not removed if set to null #62
Comments
@edgar-koster try this: <q-datetime-picker :value="oAssign.dtStart" @input="funcCheckDate" /> funcCheckDate (value) {
if (new Date(value).getTime() < new Date().getTime()) {
this.oAssign.dtStart = null
} else {
this.oAssign.dtStart = value
}
}, PS: anyway, i think u don't need momentjs at all, just look intro the date utils: |
Hmm not a difference. But... I now have you field next to the one I have and if I manually change your it changes mine :-). So change the first picker manually, the second is updated. Change the first via the picker, both are set (also the otherway around)
|
Solved, put a timout of 500 around setting it. Thanks for the help |
probably that is happening because of one of this lines:
as u can see, some times the value is updated only at the next render cycle. <q-datetime-picker v-model="__dtStart"/> export default {
computed: {
__dtStart: {
get () {
return this.oAssign.dtStart
},
set (value) {
if (new Date(value).getTime() < new Date().getTime()) {
this.oAssign.dtStart = null
} else {
this.oAssign.dtStart = value
}
}
}
}
} of course, u workaround would work too, but i would use this only as a last resort, and that would work using a very small value, like 25 (in my opinion, 500 is too much and this can create a bad impression at the user) |
Hi Toby. This sample of yours works perfectly. One additional question to complete the picture. If I select a date, it is set in the field e.g. Again, I now use your code sample. |
okay perfect actually. |
Hi. How can I force the input text (partial filled) go back to model value (null or valid date) when the focus is lost? It is strange keep the input showing different information from the model. I tried to force it on Blur event but this is not fired on this state (partial filled and loose focus). |
I currently have [email protected] with my quasar project
I have a datetime picker set as
My check date function
funcCheckDate
anddateOptions
are:For some reason, when check date is triggered by choosing a date and then manually changing it to e.g. 10/10/2018, the check date function is executed, but the value isn't removed in the datetime picker. An 'alert' in the function will show it is changed.
How can I clear the field via a script, to prevent incorrect user input
The text was updated successfully, but these errors were encountered: