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"
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'),
];
}
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
Please see CHANGELOG for more information on what has changed recently.
I Encourage you to do so.
The MIT License (MIT). Please see License File for more information.