PHP code example of mokhosh / filament-jalali

1. Go to this page and download the library: Download mokhosh/filament-jalali library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mokhosh / filament-jalali example snippets


// Yes! Just use Filament's original TextColumns!
use Filament\Tables;

Tables\Columns\TextColumn::make('created_at')
    ->jalaliDate(),
Tables\Columns\TextColumn::make('updated_at')
    ->jalaliDateTime(),

use Filament\Infolists\Components;

Components\TextEntry::make('created_at')
    ->jalaliDate(),
Components\TextEntry::make('updated_at')
    ->jalaliDateTime(),

// 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(),

use Filament\Tables;
use Filament\Infolists\Components;
use Filament\Forms;
use Illuminate\Support\Facades\App;

Tables\Columns\TextColumn::make('created_at')
    ->date()
    ->when(App::isLocale('fa'), fn (TextColumn $column) => $column->jalaliDate()),

Components\TextEntry::make('updated_at')
    ->dateTime()
    ->unless(App::isLocale('en'), fn (TextColumn $column) => $column->jalaliDateTime()),

Forms\Components\DatePicker::make('birthday')
    ->when(App::isLocale('fa'), fn (TextColumn $column) => $column->jalali()),

public function boot(): void
{
    Table::$defaultDateDisplayFormat = 'Y/m/d';
    Table::$defaultDateTimeDisplayFormat = 'Y/m/d H:i:s';
    Infolist::$defaultDateDisplayFormat = 'Y/m/d';
    Infolist::$defaultDateTimeDisplayFormat = 'Y/m/d H:i:s';
}