Skip to content

Commit

Permalink
dont try to resolve entry
Browse files Browse the repository at this point in the history
  • Loading branch information
mokhosh committed Mar 6, 2024
1 parent d95c183 commit 284a155
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/FilamentJalaliServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

use Ariaieboy\Jalali\Jalali;
use Filament\Forms\Components\DateTimePicker;
use Filament\Infolists\Components\Entry;
use Filament\Infolists\Components\TextEntry;
use Filament\Support\Assets\AlpineComponent;
use Filament\Support\Facades\FilamentAsset;
Expand Down Expand Up @@ -73,14 +72,15 @@ public function packageBooted(): void

TextEntry::macro('jalaliDate', function (?string $format = null, ?string $timezone = null) {
$format ??= config('filament-jalali.date_format');
$timezone ??= $this->getTimezone();

$this->formatStateUsing(static function (Entry $entry, $state) use ($format, $timezone): ?string {
$this->formatStateUsing(static function ($state) use ($format, $timezone): ?string {
if (blank($state)) {
return null;
}

return Jalali::fromCarbon(Carbon::parse($state)
->setTimezone($timezone ?? $entry->getTimezone()))
->setTimezone($timezone))
->format($format);
});

Expand Down

0 comments on commit 284a155

Please sign in to comment.