ankurk91 / vue-bootstrap-datetimepicker

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

Clear button not working when inline config passed #6

Closed w4matt closed 6 years ago

w4matt commented 7 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 It looks like maybe the clear button doesn't clear date, in Chrome at least ?

Expected behavior Date should clear

Minimal reproduction of the problem with instructions

Fiddles:

jquery version https://jsfiddle.net/5mce0fnx/

Vue version https://jsfiddle.net/usrpr09y/

w4matt commented 7 years ago

Sorry, looks like I pasted the wrong link for the Vue version, it should be: https://jsfiddle.net/d9rkqkq0/

ankurk91 commented 7 years ago

@Wherefour I could not reproduce this issue, checkout my jsfiddle - https://jsfiddle.net/ankurk91/zupazg2u/6/

I don't know whats wrong with your example. Same feature is working in my fiddle but not in yours, please compare.

datepicker

w4matt commented 7 years ago

Hmmm, you're right -- yours is working fine.

It looks like the difference between yours and mine is that you are passing the configs in as a property and I've hard-coded mine.

If I pass my config in as a prop, it works fine. Just curious....this is the preferred approach? I have no problem doing it this way if that's what you recommend.

Thanks for taking a look at this (and for this library too)!

w4matt commented 7 years ago

Closing this as it's a non-issue. Thanks!

ankurk91 commented 7 years ago

It should work in both ways, I will investigate it more.

w4matt commented 7 years ago

Sounds good, thanks for investigating...

ankurk91 commented 7 years ago

Interestingly when we pass config as inline object, watch for the config prop keep running on each click event, even if we have not made any change in config object.

This causes datepicker to update its configs at the time of values is being cleared.

This issue needs more investigation. A possible solution is to prevent config update if newConfig and oldConfig objects are same.

w4matt commented 7 years ago

Yeah, that could be a good way to at least make it work. It's not a big deal to pass the config values in as a prop for now though. The only reason I hard-coded it was it seemed like a quick/easy way to just set the defaults right in HTML.

Maybe the ReadMe should mention this so others don't encounter it, until a longer term fix is in place? Thanks for maintaining this library so well.

ankurk91 commented 6 years ago

Ref https://github.com/vuejs/vue/issues/4060