Added custom date format
This commit is contained in:
@@ -28,7 +28,7 @@ enum FlightNotificationType: string
|
||||
{
|
||||
return match ($this) {
|
||||
self::Booked => "{$user->name} booked a new flight",
|
||||
self::Logged => "{$user->name} logged a new flight",
|
||||
self::Logged => "{$user->name} logged a historic flight",
|
||||
self::Cancelled => "{$user->name} cancelled a flight",
|
||||
self::Departed => "{$user->name} is taking off!",
|
||||
self::Arrived => "{$user->name} has landed!",
|
||||
|
||||
+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) {
|
||||
|
||||
@@ -54,6 +54,19 @@ class SettingsRegistry
|
||||
['value' => '24hr', 'label' => '24-Hour'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'key' => 'date_format',
|
||||
'type' => 'select',
|
||||
'label' => 'Date Format',
|
||||
'category' => 'Localization',
|
||||
'default' => 'j M Y',
|
||||
'options' => [
|
||||
['value' => 'j M Y', 'label' => '20 Feb 2015'],
|
||||
['value' => 'Y-m-d', 'label' => '2015-02-20'],
|
||||
['value' => 'd/m/Y', 'label' => '20/02/2015'],
|
||||
['value' => 'm/d/Y', 'label' => '02/20/2015'],
|
||||
],
|
||||
],
|
||||
[
|
||||
'key' => 'default_login_page',
|
||||
'type' => 'select',
|
||||
|
||||
Reference in New Issue
Block a user