Charles 1900c04b71
Filament v4 🎉 (#1651)
Co-authored-by: RMartinOscar <40749467+RMartinOscar@users.noreply.github.com>
Co-authored-by: Boy132 <Boy132@users.noreply.github.com>
Co-authored-by: Lance Pioch <git@lance.sh>
2025-09-08 13:12:33 -04:00

30 lines
648 B
PHP

<?php
namespace App\Filament\Components\Tables\Columns;
use Closure;
use Filament\Tables\Columns\TextColumn;
class DateTimeColumn extends TextColumn
{
protected function setUp(): void
{
parent::setUp();
$this->dateTime();
}
public function since(string|Closure|null $timezone = null): static
{
$this->formatStateUsing(fn ($state) => $state->diffForHumans());
$this->tooltip(fn ($state) => $state?->timezone($this->getTimezone()));
return $this;
}
public function getTimezone(): string
{
return auth()->user()->timezone ?? config('app.timezone', 'UTC');
}
}