Search and Top Navigation
#4513 closed bug (fixed)
Opened May 04, 2009 10:44PM UTC
Closed June 11, 2009 10:31AM UTC
datepicker doesn't set default date in dialog
Reported by: | quasipickle | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 1.8 |
Component: | ui.datepicker | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
In IE 8 (at least - probably IE7 as well), when creating a datePicker with the dialog option, setting the second argument to a Date object does not set the default date of the datepicker. The default date must be set in the settings object with 'defaultDate'.
If 'defaultDate' is not set, but the second argument is set, the datepicker defaults to the current month.
Test page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> <script type = "text/javascript" src = "http://jqueryjs.googlecode.com/files/jquery-1.3.2.min.js"></script> <script type = "text/javascript" src = "ui.core.js"></script> <script type = "text/javascript" src = "ui.datepicker.js"></script> <script type = "text/javascript"> $(document).ready(function(){ var oDate = new Date(); oDate.setYear(1990); $("#test").datepicker( 'dialog', oDate, function(dateText,datePicker){ $("#test").val(dateText); }, { defaultDate:oDate } ); }); </script> </head> <body> <input id = "test" type = "text" /> </body> </html>
If you take out the last argument (the settings object), the datepicker will show a year of 2009. If the last argument is present, it will show a year of 1990.