uxsolutions / bootstrap-datepicker

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

Inline daterange picker #2106

Open vlahanas opened 7 years ago

vlahanas commented 7 years ago

Is it possible on the current version 1.6.1 or the development version, to have the daterange picker mode embedded (inline) format?

Azaret commented 7 years ago

Hi, Can you elaborate on what you want to achieve ? I don't think there is a build-in solution but we can help you build what you want.

vlahanas commented 7 years ago

Hello, thanks for the response. I am using two datepickers, each embedded in a separate div, and i wanted to make them work as a single daterange picker in terms of behavior.

Anyway, i managed to achieve this by manually setting 'startDate', 'endDate' within the two pickers 'changeDate' callbacks. Moreover, i am using the beforeShowDay option using css classes to change the appearance of dates lying within the selected range between the selected dates of the two pickers.

vlahanas commented 7 years ago

BTW, i think there is a possible bug when setting the startDate of a datepicker after initialization. Using element.datepicker('setStartDate', ... ); sometimes makes the datepicker to lose focus of its selected date. However, using the same command like this: element.data('datepicker').setStartDate(...); always works perfectly.

Azaret commented 7 years ago

You could also use beforeShowDay to set start and end dates.
See this example https://jsfiddle.net/uz65z29o/6/