Skip to main content

Search and Top Navigation

#6814 open bug ()

Opened January 06, 2011 12:21AM UTC

Last modified May 28, 2016 07:24AM UTC

datepicker('setDate') incorrectly overwrites current display with two datepickers

Reported by: john.firebaugh Owned by:
Priority: minor Milestone: none
Component: ui.datepicker Version: 1.8.7
Keywords: Cc:
Blocked by: Blocking:
Description
<!DOCTYPE html>
<html>
<head>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.7/jquery-ui.min.js"></script>
  <script type="text/javascript">
    $(document).ready(function () {
      $('input').datepicker();
      $('#a').datepicker('setDate', new Date(2000, 0, 1));
      $('#b').datepicker('setDate', new Date(2010, 0, 1));
      $('#a').focus();
      $('#b').datepicker('setDate', new Date(2011, 0, 1));
    })
  </script>
</head>
<body>
<form>
  <input id="a"></input>
  <input id="b"></input>
</form>
</body>
</html>

Note that '#a' is focused and open, but now displaying the date for '#b' (January 2011). This is due to improper sharing of the singleton "dpDiv".

Attachments (0)
Change History (9)

Changed May 14, 2012 04:14PM UTC by joliss comment:1

This is still happening on master (1.9.0pre).

Changed July 12, 2012 11:03AM UTC by mrozik comment:2

_comment0: commit: https://github.com/mrozik/jquery-ui/commit/fe80bfeb250290fbcfecf0f5eb26edde0ac8742d \ pull: https://github.com/jquery/jquery-ui/pull/6961342093696169049
_comment1: commit: https://github.com/maciejmrozinski/jquery-ui/commit/fe80bfeb250290fbcfecf0f5eb26edde0ac8742d \ pull: https://github.com/jquery/jquery-ui/pull/6961342094080876981
_comment2: commit: https://github.com/maciejmrozinski/jquery-ui/commit/fe80bfeb250290fbcfecf0f5eb26edde0ac8742d \ \ pull: https://github.com/jquery/jquery-ui/pull/6961342438522154365

Changed July 17, 2012 08:09PM UTC by Maciej Mroziński comment:3

resolution: → fixed
status: newclosed

Datepicker: Modified _updateDatepicker to not update display if updated instance is not current instance. Fixed #6814 - datepicker('setDate') incorrectly overwrites current display with two datepickers.

Changeset: b4ef2f7ebb1162f75d8fa3276d73e4746bcace84

Changed August 26, 2012 09:23PM UTC by scottgonzalez comment:4

resolution: fixed
status: closedreopened

This caused a much more serious problem: #8522.

Changed October 11, 2012 02:43PM UTC by scottgonzalez comment:5

milestone: 1.9.01.11.0

Changed October 27, 2012 08:19PM UTC by mikesherov comment:6

status: reopenedopen

Changed August 06, 2013 05:59PM UTC by scottgonzalez comment:7

#9482 is a duplicate of this ticket.

Changed June 24, 2014 11:43PM UTC by scottgonzalez comment:8

milestone: 1.11.0none

Changed May 28, 2016 07:24AM UTC by kyodot comment:9

This bug is not reproduced .

$(#b) component is correctly overwritten.

I tried this bug with latest version jQuery UI 1.11.4.