Example¶
normal example¶
$('.normal-example').persianDatepicker();
<input class="normal-example" />
inline example¶
$('.inline-example').persianDatepicker({ inline: true, altField: '#inlineExampleAlt', altFormat: 'LLLL', maxDate: new persianDate().add('month', 3).valueOf(), minDate: new persianDate().subtract('month', 3).valueOf(), timePicker: { enabled: true, meridiem: { enabled: true } } });
<input id="inlineExampleAlt" class="datepicker-demo" /> <div class="inline-example" ></div>
Observer¶
true, make user able to edit date by keyboard
$('.observer-example').persianDatepicker({ observer: true, format: 'YYYY/MM/DD', altField: '.observer-example-alt' });
<input class="observer-example" />
format¶
More options in Persian Date Documents
$('.format-example').persianDatepicker({ format: 'LLLL' });
<input class="format-example" />
formatter¶
$('.formatter-example').persianDatepicker({ formatter: function(unix){ return 'selected unix: ' + unix; } });
<input class="formatter-example" />
altField¶
$('.alt-field-example').persianDatepicker({ altField: '.alt-field-example-alt-field' });
<input class="alt-field-example" />
persianDigit¶
$('.persian-digit-example').persianDatepicker({ persianDigit: false });
<input class="persian-digit-example" />
viewMode¶
$('.view-mode-example').persianDatepicker({ viewMode: 'year' });
<input class="view-mode-example" />
minDate¶
$('.min-date-example').persianDatepicker({ minDate: new persianDate().unix() });
<input class="min-date-example" />
maxDate¶
$('.max-date-example').persianDatepicker({ maxDate: new persianDate().unix() });
<input class="max-date-example" />
checkDate¶
$('.check-date-example').persianDatepicker({ checkDate: function(unix){ return new persianDate(unix).day() != 4; } });
<input class="check-date-example" />
checkMonth¶
$('.check-month-example').persianDatepicker({ checkMonth: function(month){ return month < 6; } });
<input class="check-month-example" />
checkYear¶
$('.check-year-example').persianDatepicker({ checkYear: function(year){ return year >= 1391; } });
<input class="check-year-example" />
onlyTimePicker¶
$('.only-timepicker-example').persianDatepicker({ onlyTimePicker: true });
<input class="only-timepicker-example" />
autoClose¶
$('.auto-close-example').persianDatepicker({ autoClose: true });
<input class="auto-close-example" />
onSelect¶
$('.on-select-example').persianDatepicker({ onSelect: function(unix){ console.log('datepicker select : ' + unix); } });
<input class="on-select-example" />