39 lines
1.5 KiB
PHP
39 lines
1.5 KiB
PHP
<script>
|
|
(function () {
|
|
window.IeDate = window.IeDate || window.MmDate || window.MtDate || {
|
|
initDatepicker: function (selector) {
|
|
if (typeof initPersianDatepicker === 'function') {
|
|
initPersianDatepicker(selector);
|
|
return;
|
|
}
|
|
if (typeof $.fn.persianDatepicker !== 'undefined') {
|
|
$(selector).each(function () {
|
|
var $input = $(this);
|
|
if ($input.data('ie-shamsi-ready')) return;
|
|
$input.attr('autocomplete', 'off');
|
|
$input.persianDatepicker({
|
|
calendarType: 'persian',
|
|
format: typeof datepicker_date_format !== 'undefined' ? datepicker_date_format : 'YYYY/MM/DD',
|
|
autoClose: true,
|
|
initialValue: false,
|
|
observer: true,
|
|
calendar: { persian: { locale: 'fa' } },
|
|
});
|
|
$input.data('ie-shamsi-ready', true);
|
|
});
|
|
}
|
|
},
|
|
formatDisplay: function (gregorianDate) {
|
|
if (!gregorianDate) return '—';
|
|
if (typeof persianDate !== 'undefined') {
|
|
try {
|
|
var pd = new persianDate(new Date(gregorianDate));
|
|
return pd.format('YYYY/MM/DD');
|
|
} catch (e) {}
|
|
}
|
|
return gregorianDate;
|
|
},
|
|
};
|
|
})();
|
|
</script>
|