Skip to content

Commit 4498bc7

Browse files
committed
Add dateTime formatting to created_at and due date fields in various resources
1 parent 29b59c2 commit 4498bc7

File tree

7 files changed

+16
-9
lines changed

7 files changed

+16
-9
lines changed

app-modules/prospect/src/Filament/Resources/ProspectResource/Pages/ManageProspectAlerts.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ public function infolist(Infolist $infolist): Infolist
107107
TextEntry::make('suggested_intervention'),
108108
TextEntry::make('status.name'),
109109
TextEntry::make('createdBy.name')->label('Created By')->default('N/A'),
110-
TextEntry::make('created_at')->label('Created Date'),
110+
TextEntry::make('created_at')
111+
->label('Created Date')
112+
->dateTime(),
111113
]);
112114
}
113115

@@ -147,6 +149,7 @@ public function table(Table $table): Table
147149
TextColumn::make('status.name')
148150
->sortable(),
149151
TextColumn::make('created_at')
152+
->dateTime()
150153
->sortable(),
151154
])
152155
->filters([

app-modules/prospect/src/Filament/Resources/ProspectResource/Pages/ManageProspectSubscriptions.php

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ public function table(Table $table): Table
8181
->url(fn ($record) => UserResource::getUrl('view', ['record' => $record]))
8282
->color('primary'),
8383
TextColumn::make('pivot.created_at')
84+
->dateTime()
8485
->label('Subscribed At'),
8586
])
8687
->headerActions([

app-modules/student-data-model/src/Filament/Resources/EducatableResource/Pages/Concerns/CanManageEducatableSubscriptions.php

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public function table(Table $table): Table
7272
->url(fn ($record) => UserResource::getUrl('view', ['record' => $record]))
7373
->color('primary'),
7474
TextColumn::make('pivot.created_at')
75+
->dateTime()
7576
->label('Subscribed At'),
7677
])
7778
->headerActions([

app-modules/student-data-model/src/Filament/Resources/StudentResource/RelationManagers/ApplicationSubmissionsRelationManager.php

+1
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ public function table(Table $table): Table
8686
->orderBy('application_submission_states.name', $direction);
8787
}),
8888
TextColumn::make('created_at')
89+
->dateTime()
8990
->sortable(),
9091
])
9192
->actions([

app-modules/task/src/Filament/Concerns/TaskViewActionInfoList.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ public function taskInfoList(): array
8383
TextEntry::make('due')
8484
->label('Due Date')
8585
->dateTime()
86-
->default('N/A'),
86+
->placeholder('N/A'),
8787
TextEntry::make('createdBy.name')
8888
->label('Created By')
89-
->default('N/A')
89+
->placeholder('N/A')
9090
->url(fn (Task $record) => $record->createdBy ? UserResource::getUrl('view', ['record' => $record->createdBy]) : null),
9191
]),
9292
])->from('md'),

app-modules/task/src/Filament/RelationManagers/BaseTaskRelationManager.php

+1
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ public function table(Table $table): Table
109109
->badge(),
110110
TextColumn::make('due')
111111
->label('Due Date')
112+
->dateTime()
112113
->sortable(),
113114
TextColumn::make('assignedTo.name')
114115
->label('Assigned To')

app/Providers/FilamentServiceProvider.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,8 @@ public function boot(): void
217217

218218
return null;
219219
})
220-
->tooltip(function (TextColumn $column) use ($timezoneLabel): ?string {
221-
if ($column->isDateTime()) {
220+
->tooltip(function (TextColumn $column, $state) use ($timezoneLabel): ?string {
221+
if ($column->isDateTime() && ! blank($state)) {
222222
return "This time is set in {$timezoneLabel}.";
223223
}
224224

@@ -238,15 +238,15 @@ public function boot(): void
238238

239239
return null;
240240
})
241-
->hintIcon(function (TextEntry $entry): ?string {
242-
if ($entry->isDateTime()) {
241+
->hintIcon(function (TextEntry $entry, $state): ?string {
242+
if ($entry->isDateTime() && ! blank($state)) {
243243
return 'heroicon-m-clock';
244244
}
245245

246246
return null;
247247
})
248-
->hintIconTooltip(function (TextEntry $entry) use ($timezoneLabel): ?string {
249-
if ($entry->isDateTime()) {
248+
->hintIconTooltip(function (TextEntry $entry, $state) use ($timezoneLabel): ?string {
249+
if ($entry->isDateTime() && ! blank($state)) {
250250
return "This time is set in {$timezoneLabel}.";
251251
}
252252

0 commit comments

Comments
 (0)