Skip to main content

Search and Top Navigation

#7722 closed bug (notabug)

Opened September 16, 2011 12:48AM UTC

Closed April 03, 2012 07:40PM UTC

Last modified May 03, 2012 01:26AM UTC

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:
Blocked by: Blocking:
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.

Attachments (0)
Change History (11)

Changed November 21, 2011 09:33PM UTC by Jay Oster comment:1

resolution: → fixed
status: newclosed

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

(cherry picked from commit c36b43d0ee3cf7e10d82d21e3a4ca6cb954f4c16)

Changeset: 63bd71f14cac1f46fd5cfc6f157abf0bf710d347

Changed November 21, 2011 09:34PM UTC by scottgonzalez comment:2

milestone: 1.91.8.17

Changed March 09, 2012 12:51PM UTC by scottgonzalez comment:3

#8174 is a duplicate of this ticket.

Changed March 30, 2012 03:09PM UTC by scottgonzalez comment:4

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.

Changed April 03, 2012 07:38PM UTC by scottgonzalez comment:5

milestone: 1.8.17
resolution: fixed
status: closedreopened

I essentially reverted this in 4ade13450e7145100dcce3356eb1449e1a5f7090.

Changed April 03, 2012 07:40PM UTC by scottgonzalez comment:6

resolution: → invalid
status: reopenedclosed

Closing as invalid since there's no description of a bug, as mentioned above.

Changed May 03, 2012 12:25AM UTC by parasyte comment:7

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.

http://jsfiddle.net/URnu7/

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.

Changed May 03, 2012 12:49AM UTC by scottgonzalez comment:8

Your proxy for formatDate is wrong. You shouldn't force the time in, you should be adding support for time-based values.

Changed May 03, 2012 01:12AM UTC by parasyte comment:9

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.

Changed May 03, 2012 01:15AM UTC by scottgonzalez comment:10

Well, given that this is the only use case you've provided, it does solve the problem.

Changed May 03, 2012 01:26AM UTC by parasyte comment:11

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.