Showcase
Inline DateRangePicker
The demo below uses inline mode withsport
theme.
PopupDateRangePicker
Date Range Button
One-line Configuration to Create Your Own Theme
@import "base";
.CTDateRangePicker.CTDateRangePicker--default {
@include base-theme($theme-color: #337ab7, $theme-invert-color: #ffffff);
}
Features
- jQuery plugin, jQuery compatible
- Native JavaScript API
- Bootstrap3 compatible
- Zero dependency
- 3 different modes: inline, modal, dropdown
- Ability of creating new themes with simple configuration in SCSS
- Ability to add navigation constraints: you can set "before" or "after" to limit the navigation and the selection.
- Ability to switch single calendar or duo calendar.
Browser Compatibility
Safari | 10.0.3+ | |
IE | 10 | |
Edge | 38 | |
Firefox | 34.0.5+ | |
Google Chrome | 30+ |
Architecture
What You Will Get
jQuery Plugin Synopsis
// javascript
var sel = new DateRange({
start: new Date(2017, 2, 3),
end: new Date(2017, 2, 8)
});
$('#rangeInput').daterangepicker({
"calendar": {
"firstDayOfWeek" : Weekday.Sunday,
"date" : new Date,
"constraint" : {
"before" : {
year : 2017,
month : 5
},
"after" : {
year : 2010,
month : 0
}
}
},
"selection": sel,
"triggers": [ $('#showPicker') ],
"inputs": {
"range": $('#rangeInput'),
"from": $('#fromInput'),
"to": $('#toInput'),
},
});
$('#rangeInput')
.on("dateRange.pick", (e, sel) => {
console.log("dateRange.pick", sel)
})
.on("dateRange.select", (e, sel) => {
console.log("dateRange.select", sel)
})
.on("dateRange.change", (e, sel) => {
console.log("dateRange.change", sel)
})
.on("dateRange.reset", (e) => {
console.log("dateRange.reset")
})
Native API Synopsis
DateRangePicker
// typescript
import {DateRangePicker} from "./src/frameworks/jQuery";
const sel = new DateRange({
start: new Date(2017, 2, 3),
end: new Date(2017, 2, 8)
});
const inlinePicker = new DateRangePicker({
"mode": "inline",
"calendar": {
"firstDayOfWeek" : Weekday.Sunday,
"date" : new Date,
"constraint" : {
"before" : {
year : 2017,
month : 5
},
"after" : {
year : 2010,
month : 0
}
}
},
"selection": sel,
"inputs": {
"from": $("#fromDate"),
"to": $("#toDate"),
}
});
inlinePicker.render(document.getElementById('inlinePicker'));
Calendar
// typescript
import {Calendar} from "./src/Calendar";
import {DateRange} from "./src/DateRange";
// Create a Calendar object
const cal = new Calendar({
firstDayOfWeek : Weekday.Sunday,
date : new Date,
constraint : {
before : {
year : 2017,
month : 5
},
after : {
year : 2010,
month : 0
}
}
});
cal.nextYear();
cal.prevYear();
cal.nextMonth();
cal.prevMonth();
const sel = new DateRange({
start: new Date(2017, 2, 3),
end: new Date(2017, 2, 8)
});
cal.setSelection(sel);
let rows = cal.getWeekRows();
Road Map - will be included in the updates
2.0
- React Components
- Mobile support
- A well-explained tutorial
- Future updates
- Support for 3 months
- An easy to use jQuery plugin
- 4 themes
- Typedoc genereated documentation
- Complete TypeScript source code