mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-31 15:46:52 +01:00 
			
		
		
		
	 1900c04b71
			
		
	
	
		1900c04b71
		
			
		
	
	
	
	
		
			
			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>
		
			
				
	
	
		
			30 lines
		
	
	
		
			648 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			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');
 | |
|     }
 | |
| }
 |