qodesmith / datepicker

Get a date with JavaScript! A datepicker with no dependencies.
344 stars 101 forks source link

onHide triggers on every click event #72

Closed avsdev-cw closed 4 years ago

avsdev-cw commented 4 years ago

I have 2 datepickers connected (ie, start & end as described in the examples/docs) and an ajax callback in the onHide events of both.

I made an assumption that the onHide event would only trigger when it was actually hidden, but looking at these code section in I can see that its much cruder than that: https://github.com/qodesmith/datepicker/blob/cf7b261c7e49953f221d80bd41bb6f19b6b880c5/src/datepicker.js#L1037-L1039 https://github.com/qodesmith/datepicker/blob/cf7b261c7e49953f221d80bd41bb6f19b6b880c5/src/datepicker.js#L927-L933

Perhaps the documentation should be updated or it should be a true onHide event (ie, only triggered when the calendar is actually transitioning from visible to hidden)

qodesmith commented 4 years ago

Good catch. This is a bug and the onHide should only be triggered when that particular calendar is transitioning from visible to hidden. Working on a fix now.

qodesmith commented 4 years ago

Fixed in 5.2.1.