CoreUI PRO Component
To use this component you must have a CoreUI PRO license. Buy the CoreUI PRO and get access to all PRO components, features, templates, and dedicated support.
React Date Range Picker Component
Create consistent cross-browser and cross-device date range picker
Other frameworks
CoreUI components are available as native Angular, Bootstrap (Vanilla JS), and Vue components. To learn more please visit the following pages.
Example#
<CDateRangePicker label="Date range" locale="en-US" /><CDateRangePicker startDate="2022/08/03" endDate="2022/08/17" label="Date range" locale="en-US" />
With footer#
<CDateRangePicker footer locale="en-US" /><CDateRangePicker startDate="2022/08/03" endDate="2022/08/17" footer locale="en-US" />
With timepicker#
<CDateRangePicker locale="en-US" timepicker />
Sizing#
Set heights using size
property like size="lg"
and size="sm"
.
<CDateRangePicker locale="en-US" size="lg" /><CDateRangePicker locale="en-US" size="sm" />
Disabled#
Add the disabled
boolean attribute on an input to give it a grayed out appearance and remove pointer events.
<CDateRangePicker disabled locale="en-US" />
Readonly#
Add the inputReadOnly
boolean attribute to prevent modification of the input's value.
<CDateRangePicker inputReadOnly locale="en-US" />
Disabled dates#
const calendarDate = new Date(2022, 2, 1)const disabledDates = [ [new Date(2022, 2, 4), new Date(2022, 2, 7)], // range of dates that cannot be selected new Date(2022, 2, 16), // single date that cannot be selected new Date(2022, 3, 16), // single date that cannot be selected [new Date(2022, 4, 2), new Date(2022, 4, 8)], // range of dates that cannot be selected]const maxDate = new Date(2022, 5, 0)const minDate = new Date(2022, 1, 1)return ( <div className="row"> <div className="col-lg-5"> <CDateRangePicker calendarDate={calendarDate} disabledDates={disabledDates} locale="en-US" maxDate={maxDate} minDate={minDate} /> </div> </div>)
Custom ranges#
const customRanges = { Today: [new Date(), new Date()], Yesterday: [ new Date(new Date().setDate(new Date().getDate() - 1)), new Date(new Date().setDate(new Date().getDate() - 1)), ], 'Last 7 Days': [ new Date(new Date().setDate(new Date().getDate() - 6)), new Date(new Date()), ], 'Last 30 Days': [ new Date(new Date().setDate(new Date().getDate() - 29)), new Date(new Date()), ], 'This Month': [ new Date(new Date().setDate(1)), new Date(new Date().getFullYear(), new Date().getMonth() + 1, 0), ], 'Last Month': [ new Date(new Date().getFullYear(), new Date().getMonth() - 1, 1), new Date(new Date().getFullYear(), new Date().getMonth(), 0), ],}return ( <div className="row"> <div className="col-lg-5"> <CDateRangePicker ranges={customRanges} /> </div> </div>)
Non-english locale#
Auto#
<CDateRangePicker />
Chinese#
<CDateRangePicker locale="zh-CN" placeholder={["入住日期", "退房日期"]} />
Japanese#
<CDateRangePicker locale="ja" placeholder={["日付を選択", "終了日"]} />
Korean#
<CDateRangePicker locale="ko" placeholder={["