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

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

@aqjw

Description

@aqjw

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()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions