Ticket #7722 (closed bug: notabug)
Datepicker: Does not properly clear current instance when hidden.
| Reported by: | Jason Oster | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | ui.datepicker | Version: | 1.8.16 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
Test case: http://jsfiddle.net/Zyzs4/15/
'ID' should show "[Not Selected]" when all datepickers are hidden. Especially when input 3 is focused.
I have a patch that is forthcoming.
Change History
comment:1 Changed 19 months ago by Jay Oster
- Status changed from new to closed
- Resolution set to fixed
comment:4 Changed 15 months ago by scott.gonzalez
This caused a problem, as noted in #8174. @Jason: What is your actual problem that you were having before? You didn't provide an actual use case, you just showed that an internal property was not holding the value you expected. Unless you can provide an actual bug that users would experience with the public API, I am going to revert your change.
comment:5 Changed 15 months ago by scott.gonzalez
- Status changed from closed to reopened
- Resolution fixed deleted
- Milestone 1.8.17 deleted
I essentially reverted this in 4ade13450e7145100dcce3356eb1449e1a5f7090.
comment:6 Changed 15 months ago by scott.gonzalez
- Status changed from reopened to closed
- Resolution set to invalid
Closing as invalid since there's no description of a bug, as mentioned above.
comment:7 Changed 14 months ago by parasyte
Sorry about the super long delay! I had forgotten my password, and didn't have access to the source code repo where this bug was discovered. The "description of a bug" is a bit difficult to describe, so please bear with me:
I have a small jQuery plugin called jquery.datetime-picker.js, which overrides $.datepicker.formatDate() so that it can format a timestamp with time, in addition to the date. To do this, the plugin needs access to the _curInst variable. Everything works great while the datetime picker is open, but when it's closed, the _curInst variable is still available, so the plugin gets confused.
Here's a super-stripped down demo that includes some of the plugin code, plus shows the bug in action; normally it should append "12:00 AM" to the string returned by $.datepicker.formatDate() only when a datepicker with showTime param set to true. The bug is pretty obvious here: the "12:00 AM" does not go away when the datepicker is closed.
Switch to jQuery 1.7.2 + jQuery-ui 1.8.18 (which contains this patch (!)) and the bug is fixed.
TL;DR: This bug breaks any jQuery plugin that needs access to $.datepicker._curInst.
comment:8 Changed 14 months ago by scott.gonzalez
Your proxy for formatDate is wrong. You shouldn't force the time in, you should be adding support for time-based values.
comment:9 Changed 14 months ago by parasyte
That's fine, I'll squash the time setting stuff (this isn't my code, specifically, and we don't use all of the features it wants to provide) But that does not solve the problem with using _curInst.
comment:10 Changed 14 months ago by scott.gonzalez
Well, given that this is the only use case you've provided, it does solve the problem.
comment:11 Changed 14 months ago by parasyte
It's only a single example of how _curInst was used. And apparently incorrectly, considering the variable is no longer cleared when the date picker is hidden.


Datepicker: Fix this reference in _hideDatepicker(). Fixed #7722 - Datepicker: Does not properly clear current instance when hidden. (cherry picked from commit c36b43d0ee3cf7e10d82d21e3a4ca6cb954f4c16)