Skip to content

Commit 9b75bc8

Browse files
committed
humanize duration on apps page
1 parent 3d5cbb3 commit 9b75bc8

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

src/routes/cloud/apps/index.tsx

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { CreateServiceForm } from "~/components/cloud/CreateServiceForm";
55
import { cache, createAsync, A, type RouteDefinition } from "@solidjs/router";
66
import { getUser } from "~/lib/auth";
77
import { StatusBadge } from "~/components/cloud/service/StatusBadge";
8+
import humanizeDuration from "humanize-duration";
89

910
const getServices = cache(async () => {
1011
"use server";
@@ -63,11 +64,24 @@ export default () => {
6364
/>
6465
</td>
6566
<td>
66-
{new Date(
67-
service.raw.status.conditions.find(
68-
(condition) => condition.type === "RoutesReady"
69-
).lastTransitionTime
70-
).toLocaleString()}
67+
<div
68+
class="tooltip"
69+
data-tip={new Date(
70+
service.raw.status.conditions.find(
71+
(condition) => condition.type === "Ready"
72+
)?.lastTransitionTime
73+
).toLocaleString()}
74+
>
75+
{humanizeDuration(
76+
new Date(
77+
service.raw.status.conditions.find(
78+
(condition) => condition.type === "Ready"
79+
)?.lastTransitionTime
80+
).getTime() - Date.now(),
81+
{ round: true, largest: 1 }
82+
)}{" "}
83+
ago
84+
</div>
7185
</td>
7286
<td class="hidden md:block">
7387
<a class="link" href={service.raw.status.url}>

0 commit comments

Comments
 (0)