google-code-export / jquery-datepicker

Automatically exported from code.google.com/p/jquery-datepicker
1 stars 0 forks source link

how to set the selected dates in datepicker with selectMultiple enabled? #376

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I use following script to create and dpSetSelected set 2 dates in datepicker, I 
wish the datepicker will appear with the 2 dates selected.
But it does not work. Could you tell me what's wrong with it?
  $(function()
      {
        $('#inline-1')
        .datePicker(
            {
              showYearNavigation:false, 
              inline:true,
              selectMultiple:true // allow multiple dates to be selected
            }
        );
   });

   $('#indine-1').dpSetSelected("2013-08-22");  
   $('#indine-1').dpSetSelected("2013-08-23");

Please see the attachment file. Thanks.

Original issue reported on code.google.com by gavin.ca...@gmail.com on 21 Aug 2013 at 3:14

Attachments:

GoogleCodeExporter commented 9 years ago
You need to use the correct date format when you call dpSetSelected...

I just visited this page in Chrome:
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/datePickerMultiple.ht
ml

Then I entered these two lines into the javascript console:

$('.date-pick').dpSetSelected('09/09/2013');
$('.date-pick').dpSetSelected('11/09/2013');

Then I opened a date picker and both dates were shown as selected...

Original comment by kelvin.l...@gmail.com on 2 Sep 2013 at 2:07