Added custom date format
This commit is contained in:
+20
-1
@@ -153,7 +153,26 @@ class User extends Authenticatable implements MustVerifyEmail
|
||||
->toJson();
|
||||
});
|
||||
|
||||
$collection = collect(json_decode($json));
|
||||
$dateFormat = auth()->user()?->resolved_settings['date_format'] ?? 'j M Y';
|
||||
$timeFormat = auth()->user()?->resolved_settings['time_format'] === '24hr' ? 'Hi' : 'g:iA';
|
||||
|
||||
$collection = collect(json_decode($json))
|
||||
->map(function ($flight) use ($dateFormat, $timeFormat) {
|
||||
$departure = Carbon::parse($flight->departure_date)
|
||||
->setTimezone($flight->departure_airport->timezone);
|
||||
|
||||
$arrival = Carbon::parse($flight->arrival_date)
|
||||
->setTimezone($flight->arrival_airport->timezone);
|
||||
|
||||
$flight->departure_date_display = $departure->format($dateFormat);
|
||||
$flight->departure_time_display = $departure->format($timeFormat);
|
||||
|
||||
$flight->arrival_date_display = $arrival->format($dateFormat);
|
||||
$flight->arrival_time_display = $arrival->format($timeFormat);
|
||||
|
||||
return $flight;
|
||||
});
|
||||
|
||||
$today = now('UTC')->toDateString();
|
||||
|
||||
return match ($filter) {
|
||||
|
||||
Reference in New Issue
Block a user