Sanjab
Persian Date Picker forInstallation
Before start make sure you know how laravel mix works!
Install npm packages including laravel mix.
npm install
Install the sanjab npm package.
npm install sanjab --save-dev
Install sanjab Persian Date picker via npm.
npm install sanjab-persian-date-picker --save-dev
You should install the same version of the composer package if you don't have latest version.
npm install sanjab@VERSION --save-dev
Install sanjab Persian Date picker via composer.
composer require sanjabteam/sanjab-persian-date-picker
Create sanjab JS for custom compile if not created before.
resources/js/sanjab.js
:
require('sanjab');
Vue.use(require('sanjab-persian-date-picker').default); // Add this to support persian date picker
if (document.querySelector('#sanjab_app')) {
window.sanjabApp = new Vue({
el: '#sanjab_app',
});
}
add js file to webpack.mix.js
for compile.
mix.js('resources/js/sanjab.js', 'public/vendor/sanjab/js')
Compile and you are ready.
npm run prod
Usage
use SanjabPersianDatePicker\PersianDatePickerWidget;
// Date only
$this->widgets[] = PersianDatePickerWidget::create('birth_date')
->rules('jdate_before:'.verta()->formatDate())
->required();
// Date and time
$this->widgets[] = PersianDatePickerWidget::create('released_at')
->rules('jdate_before:'.verta()->formatDate())
->required()
->time(true);
Credits
License
The MIT License (MIT). Please see License File for more information.