filament-jalali
filament-jalali copied to clipboard
Add Jalali datetime to your filament tables
Add "Jalali calendar" columns and pickers to Filament
No fuss package to add Jalali Date and DateTime columns to your table, and a beautiful Jalali Date and DateTime picker to your forms.
No new column type, just keep using your good old TextColumns!
No new form components, just keep using your beautiful DatePickers and DateTimePickers!
Installation
You can install the package via composer:
composer require mokhosh/filament-jalali
Usage
To add Jalali date and date-time columns to your tables, just add jalaliDate and jalaliDateTime to the filament TextColumns instead of date or dateTime.
// Yes! Just use Filament's original TextColumns!
use Filament\Tables;
Tables\Columns\TextColumn::make('created_at')
->jalaliDate(),
Tables\Columns\TextColumn::make('updated_at')
->jalaliDateTime(),
To add Jalali date and date-time columns to your infolists, just add jalaliDate and jalaliDateTime to the filament TextEntrys instead of date or dateTime.
use Filament\Infolists\Components;
Components\TextEntry::make('created_at')
->jalaliDate(),
Components\TextEntry::make('updated_at')
->jalaliDateTime(),
To add Jalali date and date-time pickers to your forms, just add jalalito your DatePicker and DateTimePicker.
// Yes! Just use Filament's original DatePickers and DateTimePickers!
use Filament\Forms;
Forms\Components\DatePicker::make('moderated_at')
->jalali(),
Forms\Components\DateTimePicker::make('published_at')
->jalali(),
Config
You can optionally publish the config file with:
php artisan vendor:publish --tag="filament-jalali-config"
This is the contents of the published config file:
return [
'date_format'=>'Y/m/d',
'datetime_format'=>'Y/m/d H:i:s',
];
Credits
- Mo Khosh
- All Contributors
License
The MIT License (MIT). Please see License File for more information.