mariomka / vue-datetime

Mobile friendly datetime picker for Vue. Supports date and datetime modes, i18n and more.
http://mariomka.github.io/vue-datetime
MIT License
986 stars 245 forks source link

Initial input event firing with vee-validate #177

Open kenazs opened 4 years ago

kenazs commented 4 years ago

Versions

Description:

Why is an input event fired with initial values? This interferes with vee-validation that works on input event.

Steps To Reproduce:

template: <datetime v-model="model.test1" @input="debug('test1')" /> <input v-model="model.test2" @input="debug('test2')" />

method: debug(event) { console.log(event); }

"test1" displayed in console and "test2" didn't

mariomka commented 4 years ago

It is fired on created hook to format the initial value. For vee-validate 2.x you can disable auto validation with data-vv-validate-on="none" and run it on close event.

mydnic commented 4 years ago

@mariomka how to prevent the initial input event ? I have an auto save feature on a form, and every time the form is shown, it triggers my API calls

dargmuesli commented 4 years ago

Firing an initial input event is a little incorrect, don't you think @mariomka? Like... input is meant for when data is entered and most libraries use it at such. So when this library fires an initial input event, that leads to issues. What if there is no initial value?