Skip to content
This repository has been archived by the owner on Jan 7, 2022. It is now read-only.

Datetime component fires this.emitInput() upon creation - Solved #272

Open
aqjw opened this issue Oct 23, 2021 · 0 comments
Open

Datetime component fires this.emitInput() upon creation - Solved #272

aqjw opened this issue Oct 23, 2021 · 0 comments

Comments

@aqjw
Copy link

aqjw commented Oct 23, 2021

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch vue-datetime@1.0.0-beta.14 for the project I'm working on.

Fixed issue #46

Here is the diff that solved my problem:

diff --git a/node_modules/vue-datetime/src/Datetime.vue b/node_modules/vue-datetime/src/Datetime.vue
index a8d9e99..4c28881 100644
--- a/node_modules/vue-datetime/src/Datetime.vue
+++ b/node_modules/vue-datetime/src/Datetime.vue
@@ -206,7 +206,8 @@ export default {
         datetime = startOfDay(datetime)
       }
 
-      this.$emit('input', datetime ? datetime.toISO() : '')
+      const value = datetime ? datetime.toISO() : null
+      this.datetime !== value ? this.$emit('input', value) : null
     },
     open (event) {
       event.target.blur()
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant