sanjabteam/sanjab-persian-date-picker

This package is abandoned and no longer maintained. No replacement package was suggested.

Persian date picker for laravel sanjab (https://github.com/sanjabteam/sanjab)

v0.2.1 2020-12-12 21:02 UTC

This package is auto-updated.

Last update: 2023-09-06 14:35:44 UTC


README

Installation

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.