ankurk91 / vue-bootstrap-datetimepicker

Vue.js component for eonasdan bootstrap datetimepicker
MIT License
223 stars 66 forks source link

5.0.0-beta.2 crashes browser when using with a computed property #38

Closed NARKOZ closed 6 years ago

NARKOZ commented 6 years ago

I'm submitting a ... (check one with "x")

[x] Bug report => search github for a similar issue or PR before submitting
[ ] Feature request
[ ] Other, please describe

Tell about your platform

Current behavior

Tab freezes or crashes when changing a date.

Expected behavior

Minimal reproduction of the problem with instructions

https://jsfiddle.net/01407frf/558/

ankurk91 commented 6 years ago

This is obvious, your getter and setter is causing a infinite loop.


prettyDate: {
        get () {
        // you are watching v-model, but also updating prettyDate value
        return moment(this.date).local().format(this.options.format);
      },
      set (value) {
        // you are updating v-model, when you updates prettyDate value
    this.date = moment(value).utc().format(this.options.format);
      }
    }

This component also watches v-model internally. What are you trying to achieve ?

NARKOZ commented 6 years ago

Thanks.