ultimatepos/Modules/ProfessionalProject/Resources/views/partials/shamsi_datepicker.blade.php

36 lines
1.0 KiB
PHP

<script>
(function () {
function initShamsiDatepicker() {
if (typeof $ === 'undefined' || !$.fn || !$.fn.persianDatepicker) {
return;
}
$('.datepicker').each(function () {
var $input = $(this);
if ($input.data('pp-shamsi-ready')) {
return;
}
$input.attr('autocomplete', 'off');
try {
$input.persianDatepicker({
format: 'YYYY/MM/DD',
autoClose: true,
initialValue: false,
observer: true,
calendar: {
persian: {
locale: 'fa'
}
}
});
$input.data('pp-shamsi-ready', true);
} catch (e) {
// Fallback to default datepicker if Persian datepicker is unavailable at runtime.
}
});
}
$(document).ready(initShamsiDatepicker);
})();
</script>