Skip to content

Commit e1acafc

Browse files
committed
fix(admin): create readable updated/create at column values
1 parent 86c82d1 commit e1acafc

File tree

2 files changed

+34
-3
lines changed

2 files changed

+34
-3
lines changed

client/components/admin/AdminTable.vue

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,20 @@
5757
<td class="text-muted">{{ user.attributes.email }}</td>
5858
<td class="text-muted">{{ user.attributes.active == 1 ? "Active" : "Inactive" }}</td>
5959
<td class="text-muted">{{ user.attributes.isAdmin == 1 ? "Yes" : "No" }}</td>
60-
<td class="text-muted">{{ user.attributes.created }}</td>
61-
<td class="text-muted">{{ user.attributes.updated }}</td>
60+
<td class="text-muted">
61+
{{
62+
formatDate
63+
? formatDate(user.attributes.created_at || user.attributes.created)
64+
: user.attributes.created_at || user.attributes.created
65+
}}
66+
</td>
67+
<td class="text-muted">
68+
{{
69+
formatDate
70+
? formatDate(user.attributes.updated_at || user.attributes.updated)
71+
: user.attributes.updated_at || user.attributes.updated
72+
}}
73+
</td>
6274
<td class="text-muted">
6375
<a href="#" data-bs-toggle="modal" data-bs-target="#modal-user" @click="$emit('edit-user', user)">
6476
Edit
@@ -135,6 +147,10 @@ defineProps({
135147
type: String,
136148
default: "",
137149
},
150+
formatDate: {
151+
type: Function,
152+
default: null,
153+
},
138154
});
139155
140156
defineEmits(["page-size-change", "search-input", "search", "edit-user", "delete-user", "previous-page", "next-page"]);

client/views/admin/Dashboard.vue

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
</div>
5151
</a>
5252
<div class="dropdown-menu dropdown-menu-end dropdown-menu-arrow">
53-
<p class="dropdown-item" @click="logout()">logout</p>
53+
<p class="dropdown-item" @click="logout()">Logout</p>
5454
</div>
5555
</div>
5656
</div>
@@ -144,6 +144,7 @@
144144
@delete-user="deleteUserRecord"
145145
@previous-page="previousPage"
146146
@next-page="nextPage"
147+
:format-date="formatDate"
147148
/>
148149
</div>
149150
</div>
@@ -160,6 +161,7 @@
160161
href="https://github.com/authcompanion/authcompanion2/blob/main/CHANGELOG.md"
161162
class="link-secondary"
162163
rel="noopener"
164+
target="_blank"
163165
>
164166
Changelog
165167
</a>
@@ -232,6 +234,19 @@ import UserModal from "../../components/admin/UserModal.vue";
232234
import AdminTable from "../../components/admin/AdminTable.vue";
233235
import ErrorAlert from "../../components/ErrorAlert.vue"; // Updated import
234236
237+
// Utility: Format ISO date string to human-readable
238+
function formatDate(dateStr) {
239+
if (!dateStr) return "";
240+
const date = new Date(dateStr);
241+
return date.toLocaleString(undefined, {
242+
year: "numeric",
243+
month: "short",
244+
day: "numeric",
245+
hour: "2-digit",
246+
minute: "2-digit",
247+
});
248+
}
249+
235250
// Reactive state
236251
const adminEmail = ref("");
237252
const users = reactive({ data: [] });

0 commit comments

Comments
 (0)