Opened 8 years ago

Last modified 3 years ago

#6814 open bug

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".

Change History (9)

comment:1 Changed 7 years ago by joliss

This is still happening on master (1.9.0pre).

comment:3 Changed 7 years ago by Maciej Mroziński

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

comment:4 Changed 7 years ago by Scott González

Resolution: fixed
Status: closedreopened

This caused a much more serious problem: #8522.

comment:5 Changed 6 years ago by Scott González

Milestone: 1.9.01.11.0

comment:6 Changed 6 years ago by mikesherov

Status: reopenedopen

comment:7 Changed 6 years ago by Scott González

#9482 is a duplicate of this ticket.

comment:8 Changed 5 years ago by Scott González

Milestone: 1.11.0none

comment:9 Changed 3 years ago by kyodot

This bug is not reproduced . $(#b) component is correctly overwritten. I tried this bug with latest version jQuery UI 1.11.4.

Note: See TracTickets for help on using tickets.