uxsolutions / bootstrap-datepicker

A datepicker for twitter bootstrap (@twbs)
Apache License 2.0
12.67k stars 6.07k forks source link

getStartDate and getEndDate not work for date range #1818

Open yskeat opened 8 years ago

yskeat commented 8 years ago

refer to http://eternicode.github.io/bootstrap-datepicker/ $('#sandbox-container input').datepicker('getDate') will return a selected value in date object.

when change to range, after select both start and end using picker ui, $('#sandbox-container .input-daterange').datepicker('getStartDate') or $('#sandbox-container .input-daterange').datepicker('getEndDate') just return an object similar to $('#sandbox-container .input-daterange').

Can i expect getStartDate will return a selected date from , or I misunderstand the documentation?

burkovsky commented 8 years ago

Hi @yskeat. I haven't tried getStartDate / getEndDate methods but I think you can get needed values with getDates / getUTCDates methods. For example

HTML markup: <div class="input-group input-daterange js-filters-date"> <input type="text" class="form-control js-filters-date-start" /> <span class="input-group-addon">to</span> <input type="text" class="form-control js-filters-date-end" /> </div>

and JavaScript: $('.js-filters-date').datepicker(); ... var startDate = $('.js-filters-date-start').datepicker('getDates'); var endDate = $('.js-filters-date-end').datepicker('getDates');