PeriodPicker jQuery plugin select range dates
Perfect period picker for CMS or CRM
Getting started
Extract bought archive and include after </body> next
<link rel="stylesheet" href="/build/jquery.periodpicker.min.css">
<script src="/jquery.min.js"></script>
<script src="/build/jquery.periodpicker.full.min.js"></script>
Some HTML form elements input period
<input id="periodpickerstart" type="text" />
<input id="periodpickerend" type="text" />
Simple init
jQuery('#periodpickerstart').periodpicker({
end: '#periodpickerend'
});
If you want use TimePicker or PeriodTimePicker or DateTimePicker include
<link rel="stylesheet" href="/build/jquery.timepicker.min.css">
<script src="/build/jquery.timepicker.min.js"></script>
and use timepicker and timepickerOptions settings. For example will make datetimepicker
jQuery('#datetimepicker').periodpicker({
norange: true, // use only one value
cells: [1, 1], // show only one month
resizeButton: false, // deny resize picker
fullsizeButton: false,
fullsizeOnDblClick: false,
timepicker: true, // use timepicker
timepickerOptions: {
hours: true,
minutes: true,
seconds: false,
ampm: true
}
});
Or you can use alone timepciker. More about timepicker
jQuery('#timepicker').timepickeralone({
hours: true,
minutes: true,
seconds: true,
ampm: false
});
Compact mode
jQuery('#compact_mode').periodpicker({
cells: [1, 1],
withoutBottomPanel: true,
yearsLine: false,
title: false,
closeButton: false,
fullsizeButton: false
});
Browser support
- Internet Explorer 9+
- Opera 12+
- Safari 6
- Firefox 3.x+
- Chrome 25+
Changelog
Version 5.5.1
Added buttonClassSuffix
option
Fix a bug in the cleanup button, when after cleaning the picker was opened
Added events onChange
and onChangePeriod
Version 5.3.5
Fixed Issue 47
Version 5.3.1
Added option todayButton
and onTodayButtonClick
event
jQuery('#picker-with-today-button').periodpicker({
todayButton: true
});
Result
and event
jQuery('#picker-with-today-button-event').periodpicker({
todayButton: true,
onTodayButtonClick: function () {
this.month = 1;
this.year = 2027;
this.regenerate();
return false;
},
});
Result
Options
Name | default | Descr | Ex. |
---|---|---|---|
buttonClassSuffix | "" | Add class to main button | {buttonClassSuffix: " btn btn-primary"} |
tabIndex | 0 | Tab index for focusable | {tabIndex:1} |
Example
|
|||
lang | en | The localization key. | {lang:ru} |
Example
|
|||
animation | true | Use css animation when periodpicker is opened | |
Example
|
|||
i18n | {...} | Localization store | |
Example
|
|||
withoutBottomPanel | false | Do not show the bottom panel with buttons and input elements | |
Example
|
|||
showTimepickerInputs | true | Show inputs for enterind times | |
Example
|
|||
showDatepickerInputs | true | Show inputs for enterind times | |
Example
|
|||
timepicker | false | Use timepickers in preriodpicker | |
Example
|
|||
useTimepickerLimits | true | Don't allow set time2 less than time1 and time1 more than time2 in timepickers when was selected range | |
timepickerOptions | {} | Options for timepicker. More options | |
Example
|
|||
defaultEndTime | false | If you need different defaultTime for start and for end use this option for END, and timepickerOptions.defaultTime for START | |
Example
|
|||
yearsLine | true | Show years selecter line | {yearsLine: false} |
Example
|
|||
title | true | Show title | {title: false} |
Example
|
|||
inline | false | Show periodpicker inline mode | {inline: true} |
Example
|
|||
clearButtonInButton | false | Show clear value button in main button | {clearButtonInButton: true} |
Example
|
|||
clearButton | false | Show clear value button in periodpicker | {clearButton: true} |
Example
|
|||
closeAfterClear | false | Hide periodpicker after clear operation | {closeAfterClear: true} |
Example
|
|||
todayButton | false | Show «Today» button. Go picker to current day | {todayButton: true} |
Example
|
|||
okButton | true | Show «OK» button | {okButton: false} |
Example
|
|||
closeButton | true | Show «× Close» button | {closeButton: false} |
Example
|
|||
fullsizeButton | true | Show «Open on fullsize» button | {fullsizeButton: false} |
Example
|
|||
resizeButton | true | Show «Resize» button and enable Resize opportunity | {resizeButton: false} |
Example
|
|||
navigate | true | Show «Next/Prev» buttons | {navigate: false} |
Example
|
|||
fullsizeOnDblClick | true | When you click on picker's header open fullsize mode | {fullsizeOnDblClick: false} |
Example
|
|||
fullsize | true | Always open picker in fullsize mode | {fullsize: false} |
Example
|
|||
draggable | true | Allow drag picker by header | {draggable: false} |
Example
|
|||
mousewheel | true | Allow use mousewheel for change picker's. Work only when plugin mousewheel was included | {mousewheel: false} |
Example
|
|||
mousewheelYearsLine | true | If true, then when scrolling the mouse wheel over lightYears, it will not be constantly changing the month and year will | {mousewheelYearsLine: false} |
reverseMouseWheel | true | If mousewheel is true, you can exchange his behavior | {reverseMouseWheel: false} |
Example
|
|||
hideAfterSelect | false | When period choosen periodpicker closed | {hideAfterSelect: true} |
Example
|
|||
hideOnBlur | true | When enabled likeXDSoftDateTimePicker mode, and form has more 1 elements, source input lose focus | {hideOnBlur: false} |
Example
|
|||
norange | false | Use like simple datepicker | {norange: true} |
Example
|
|||
formatMonth | 'MMMM YYYY' | Mounth's name will show in this format. Use moment.js formats | {formatMonth: 'MM YY'} |
Example
|
|||
formatDecoreDate | 'D MMMM' | This option needed for show in button resulted period. Use moment.js formats | {formatDecoreDate: 'DD.MM'} |
Example
|
|||
formatDecoreDateWithoutMonth | 'D' | When month and year from first value equal month and year from second value, in first part is shown only date. Use moment.js formats | {formatDecoreDateWithoutMonth: 'DD'} |
Example
|
|||
formatDecoreDateWithYear | 'D MMMM YYYY' | It uses the same place where «formatDecoreDate» but when year of first period's value not equal year of second. Use moment.js formats | {formatDecoreDateWithYear: 'DD.MM.YYYY'} |
Example
|
|||
formatDate | 'YYYY/MM/DD' | Inside format, use when you need get values from with «valueStringStrong» command. Use moment.js formats. Also this format is used for return value in form input | {formatDate: 'DD.MM.YYYY'} |
Example
|
|||
formatDecoreDateTime | 'D MMMM' | Similarly formatDecoreDate but
using the options timepicker:true |
{formatDecoreDateTime: 'DD.MM'} |
formatDecoreDateTimeWithoutMonth | 'HH:mm D' | Similarly formatDecoreDateWithoutMonth
but using the options timepicker:true |
{formatDecoreDateTimeWithoutMonth: 'DD'} |
formatDecoreDateTimeWithYear | 'HH:mm D MMMM YYYY' | Similarly formatDecoreDateWithYear
but using the options timepicker:true |
{formatDecoreDateTimeWithYear: 'DD.MM.YYYY'} |
formatDateTime | 'HH:mm YYYY/MM/D' | Similarly formatDate but using the
options timepicker:true |
{formatDateTime: 'DD.MM.YYYY'} |
end | '' | Identificator of input element or element for secod period's value | {end: $('#input2')} |
noHideSourceInputs | false | Do not hide the original input elements | {noHideSourceInputs: true} |
likeXDSoftDateTimePicker | false | Hide Picker button, not hide the source input fields. If the input field gets the focus it displays periodpiker. Behavior similar to datetimepicker | {likeXDSoftDateTimePicker: true} |
Example
|
|||
startMonth | Current month | Number of month 1..12 for start picker's position. Work only inputs don't have values | {startMonth: 12} |
Example
|
|||
startYear | Current year | Year for start picker's position. Work only inputs don't have values | {startYear: 2002} |
Example
|
|||
dayOfWeekStart | 7 | Day for start week. Mon - 1,Tue - 2,Wen - 3,Thu - 4, Fri - 5, Sat - 6, Sun - 7 | {dayOfWeekStart: 1} |
Example
|
|||
yearSizeInPixels | 120 | The width of one of the all periods yearsline in pixel. Use when you change «yearsPeriod» option | {yearSizeInPixels: 300} |
yearsPeriod | [2000 , Current Year + 20] | Period for YearsLine | {yearsPeriod: [2002, 2005]} |
Example
|
|||
weekEnds | [6,7] | The days of the week, which will be designated as weekend. Mon - 1,Tue - 2,Wen - 3,Thu - 4, Fri - 5, Sat - 6, Sun - 7 | {weekEnds: [7]} |
Example
|
|||
holidays | [] | Days which will highlight like weekends. In «formatDate» format |
|
Example
|
|||
disableDays | [] | Disable days. These days you can not select. In «formatDate» format |
|
Example
|
|||
minDate | false | Disable all days before this value. These days you can not select. In «formatDate» format |
|
Example
|
|||
maxDate | false | Disable all days after this value. These days you can not select. In «formatDate» format |
|
Example
|
|||
cells | [1,3] | Default size for picker count rows (minimum - 1) and count cols (minimum - 3). |
|
Example
|
|||
utcOffset | null | Setting the utc offset by supplying minutes http://momentjs.com/docs/#/manipulating/utc-offset/ | |
Example
|
Events
Name | Descr |
---|---|
onAfterShow | Fires after the picker shows |
Example
|
|
onAfterHide | Fires after the picker had hidden |
Example
|
|
onAfterRegenerate | Fires after picker regenerates. After resize, after change year and month, and after show(fires before onAfterShow). |
Example
|
|
onOkButtonClick | Fired when user click on OK button |
Example
|
|
onTodayButtonClick | Fired when user click on Today button |
Example
|
|
onChange | Fired when user change picker's value |
Example
|
|
onChangePeriod | Fired when user select or change period picker's value |
Example
|
Commands
Name | Descr |
---|---|
picker | Return main PeriodPicker JS object |
Example
|
|
regenerate | Regenerate picker widget. Has one parameter cells |
Example
|
|
setOption | Change options |
Example
|
|
setOptions | Change options |
Example
|
|
change | Change period's values from input |
Example
|
|
destroy | Destroy picker |
Example
|
|
hide | Hide opened picker |
Example
|
|
show | Open picker |
Example
|
|
clear | Clear picker's value |
Example
|
|
value | Return period array [[Date, Date]]. if there is a second parameter, the period will be set on it |
Example
|
|
valueStringStrong | Return period value in formatDate strong format |
Example
|
|
valueString | Return period value in formatDecoreDate(formatDecoreDateWithYear) format |
Example
|
|
disable | Disable picker's trigger button |
Example
|
|
enable | Enable picker's trigger button |
Example
|
It is paid extension. If you buy it you help all my opensource projects. Thank you!
Download