aloko / nova-persian-datepicker
Persian Datepicker for Laravel Nova.
Installs: 2 769
Dependents: 0
Suggesters: 0
Security: 0
Stars: 18
Watchers: 3
Forks: 2
Open Issues: 23
Language:Vue
Requires
- php: >=7.1.0
- dev-master
- v0.1.1
- v0.1.0
- dev-dependabot/npm_and_yarn/express-4.18.2
- dev-dependabot/npm_and_yarn/decode-uri-component-0.2.2
- dev-dependabot/npm_and_yarn/loader-utils-1.4.2
- dev-dependabot/npm_and_yarn/css-what-2.1.3
- dev-dependabot/npm_and_yarn/minimist-1.2.6
- dev-dependabot/npm_and_yarn/url-parse-1.5.10
- dev-dependabot/npm_and_yarn/follow-redirects-1.14.8
- dev-dependabot/npm_and_yarn/chownr-1.1.4
- dev-dependabot/npm_and_yarn/path-parse-1.0.7
- dev-dependabot/npm_and_yarn/tar-2.2.2
- dev-dependabot/npm_and_yarn/dns-packet-1.3.4
- dev-dependabot/npm_and_yarn/hosted-git-info-2.8.9
- dev-dependabot/npm_and_yarn/lodash-4.17.21
- dev-dependabot/npm_and_yarn/y18n-3.2.2
- dev-dependabot/npm_and_yarn/elliptic-6.5.4
- dev-dependabot/npm_and_yarn/ini-1.3.7
- dev-dependabot/npm_and_yarn/node-sass-4.14.1
- dev-dependabot/npm_and_yarn/websocket-extensions-0.1.4
- dev-dependabot/npm_and_yarn/lodash.mergewith-4.6.2
This package is auto-updated.
Last update: 2024-11-09 02:16:12 UTC
README
Description
This package adds flexibility to work with Persian/Jalali dates in Laravel Nova resources. It provides two fields, PersianDate
and PersianDateTime
.
Installation and Usage
You may require this package using composer:
composer require aloko/nova-persian-datepicker
To use these fields, you add the following to your resource's fields()
method:
use Aloko\PersianDatepicker\PersianDate; use Aloko\PersianDatepicker\PersianDateTime; PersianDate::make('date_of_birth'), // For date fields PersianDateTime::make('check_in') // For datetime fields
NOTE: Please don't forget to cast your date
and datetime
fields in your model class as explained in Attribute Casting in Laravel Docs, otherwise these fields will throw casting error.
How it Works
Under the hood, this package uses the awesome Babakhani Datepicker library. Below screenshots are some samples of how this package works.
Screenshots
Persian Date Field
You can also select gregorian date using the same datepicker.
Persian Date Time Field
The datetime field will also have a time picker.
Methods
You can use format()
method as below to alter the way dates are displayed. Please note that format
string must match the standard explained in Babakhani Persian Date format docs.
PersianDate::make('date_of_birth')->format('YYYY-MM'), // This will only print year and month PersianDateTime::make('check_in')->format('hh:mm') // This will only show hours and minutes
To Do
Below are items that needs to or will be improved in future.
- Better locale support
- Make it possible to accept almost all datepicker options available on PHP side for customization
Special Thanks
- Reza Babakhani https://github.com/babakhani
License
The MIT License (MIT). Please see License File for more information.