skratchdot / react-bootstrap-daterangepicker

A date/time picker for react (using bootstrap). This is a react wrapper around the bootstrap-daterangepicker project.
http://projects.skratchdot.com/react-bootstrap-daterangepicker/
Other
474 stars 203 forks source link

singleDatePicker Attribute Not Working #240

Closed jwhiteside2015 closed 3 years ago

jwhiteside2015 commented 3 years ago

After setting the singleDatePicker attribute to true, I still get 2 calendars when opening the DateRangePicker:

<DateRangePicker singleDatePicker="true">
  <input className="form-control" type="text" id="startTime"></input>
</DateRangePicker>

image

I thought maybe I needed to pass it in in the initialSettings attribute, but that didn't work either:

<DateRangePicker initialSettings={{ singleDatePicker: "true" }}>
  <input className="form-control" type="text" id="startTime"></input>
</DateRangePicker>
jwhiteside2015 commented 3 years ago

For anyone else facing this issue, the problem was that I was passing singleDatePicker the string "true", rather than the boolean true in the initialSettings attribute. The below worked:

<DateRangePicker id="startTimeQueryFilter" name="startTimeQueryFilter" initialSettings={{ singleDatePicker: true }}>
  <input id="startTime" name="startTime" className="form-control" type="text"></input>
</DateRangePicker>