Skip to main content

Search and Top Navigation

#8907 open bug ()

Opened December 13, 2012 03:07PM UTC

Last modified April 21, 2016 02:11AM UTC

Datepicker: Calling a method on a datepicker while another datepicker is open causes issues

Reported by: dharr@pubpress.com Owned by:
Priority: minor Milestone: none
Component: ui.datepicker Version: 1.9.2
Keywords: Cc:
Blocked by: Blocking:
Description

When the user double-clicks to select a date from the DatePicker tool on #datepicker1, the "defaultDate" setting on #datepicker2 is causing the actual field value to be set to the current date. When I step through the code, this does not happen. It only happens when not in debug mode.

Attachments (0)
Change History (10)

Changed December 13, 2012 03:14PM UTC by dharr@pubpress.com comment:1

_comment0: When the user double-clicks to select a date from the DatePicker tool on #datepicker1, the "defaultDate" setting on #datepicker2 is causing the actual field value to be set to the current date. When I step through the code, this does not happen. It only happens when not in debug mode. \ \ Here's the sample code to reproduce the issue: http://jsfiddle.net/nwpq7/3/1355411767277619

Sorry, first time user. Here's the code on jsFiddle: http://jsfiddle.net/nwpq7/3/

Changed December 13, 2012 03:26PM UTC by scottgonzalez comment:2

description: When the user double-clicks to select a date from the DatePicker tool on #datepicker1, the "defaultDate" setting on #datepicker2 is causing the actual field value to be set to the current date. When I step through the code, this does not happen. It only happens when not in debug mode. \ \ Here's the sample code to reproduce the issue: \ \ {{{ \ <html lang="en"> \ <head> \ <meta charset="utf-8" /> \ <title>jQuery UI Datepicker - Double-Click Issue</title> \ <link rel="stylesheet" href="http://code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css" /> \ <script src="http://code.jquery.com/jquery-1.8.3.js"></script> \ <script src="http://code.jquery.com/ui/1.9.2/jquery-ui.js"></script> \ <script> \ Date.prototype.addDays = function (days) { \ var dt = new Date(this.valueOf()); \ var ms = dt.getTime() + (86400000 * days); \ var added = new Date(ms); \ return $.datepicker.formatDate('mm/dd/yy', added); \ } \ \ $(function() { \ $( "#datepicker1" ).datepicker(); \ $( "#datepicker2" ).datepicker(); \ $("#datepicker1").change(function () { \ var $d1 = $("#datepicker1"); \ var $d2 = $("#datepicker2"); \ if ($d2.val() == "" && $d1.val() != "") { \ var d = new Date($d1.val()); \ $d2.datepicker("option", "defaultDate", d.addDays(8)); \ } \ }); \ }); \ </script> \ </head> \ <body> \ \ <p>Date1: <input type="text" id="datepicker1" /></p> \ <p>Date2: <input type="text" id="datepicker2" /></p> \ \ \ </body> \ </html> \ }}}When the user double-clicks to select a date from the DatePicker tool on #datepicker1, the "defaultDate" setting on #datepicker2 is causing the actual field value to be set to the current date. When I step through the code, this does not happen. It only happens when not in debug mode. \
status: newopen

Changed January 25, 2013 09:23PM UTC by tj.vantoll comment:3

milestone: 1.10.0none

Changed September 02, 2015 02:54PM UTC by scottgonzalez comment:4

summary: DatePicker Double-Click Issue with setting defaultDate on Another DatePickerDatepicker: Calling a method on a datepicker while another datepicker is open causes issues

What happens is that calling a method on datepicker 2 while datepicker 1 is open causes datepicker 2 to be rendered in place of datepicker 1. You can see this happening by selecting a date in a different month for datepicker 2, then selecting a date in datepicker 1; you'll see the month switch as the datepicker is closing.

Changed September 02, 2015 02:57PM UTC by scottgonzalez comment:5

#14450 is a duplicate of this ticket.

Changed October 26, 2015 10:40PM UTC by scottgonzalez comment:6

#14738 is a duplicate of this ticket.

Changed April 19, 2016 01:08PM UTC by scottgonzalez comment:7

#14949 is a duplicate of this ticket.

Changed April 20, 2016 02:15AM UTC by jasonkw9 comment:8

Is this bug fixed?

Changed April 20, 2016 02:38PM UTC by scottgonzalez comment:9

No, if it were, the ticket would be closed.

Changed April 21, 2016 01:52AM UTC by rjollos comment:10

_comment0: Replying to [comment:9 scottgonzalez]: \ > So is there any ways to prevent it from happening? \ 1461204676216629

Replying to [comment:9 scottgonzalez]:

So is there any ways to prevent it from happening?