shalior / filament-persian-date-field
A FilamentPhp form field to pick persian dates
Installs: 1 167
Dependents: 0
Suggesters: 0
Security: 0
Stars: 15
Watchers: 1
Forks: 1
Open Issues: 5
Requires
- php: ^8.0
- filament/forms: ^3.0
- filament/tables: ^3.0
- illuminate/contracts: ^10.0
- spatie/laravel-package-tools: ^1.9.2
Requires (Dev)
- nunomaduro/collision: ^6.0
- orchestra/testbench: ^8.0
- pestphp/pest: ^1.21
- pestphp/pest-plugin-laravel: ^1.1
- phpunit/phpunit: ^9.5
README
Installation
You can install the package via composer:
composer require shalior/filament-persian-date-field
To use with filament v2 use version ^1
You can publish the config file with:
php artisan vendor:publish --tag="filament-persian-date-field-config"
Usage
You'll use this component with Filament forms.
It syncs the related gregorian date (as string: Y-m-d
) with your LiveWire component.
Use the field like any other filament form fields:
protected function getFormSchema(): array { return [ \Shalior\FilamentPersianDateField\Components\PersianDatePicker::make('persianDate') ->id('persian-date') ->maxDate(now()->format('Y-m-d')) ->minDate(now()->subWeek()->format('Y-m-d')) ->withoutTime() ->viewMode('month') // accepts 'day', 'month', 'year' ->default('2022-04-28'), ]; }
Persian date table column
You can use this field as a column in your table:
The column assumes you've installed verta or morilog/jalali
if neither of them is installed, it will use Carbon's translatedFormat()
Shalior\FilamentPersianDateField\Columns::make('created_at') ->translateLabel() ->format('Y/m/d') // default is 'H:i:s Y/m/d' ->timeZone('Asia/Tehran'), // default is 'Asia/Tehran' // renders as: ۱۳۹۹/۰۸/۰۱ in the table
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
I Encourage you to do so.
Credits
License
The MIT License (MIT). Please see License File for more information.