Skip to content

Commit

Permalink
humanize duration on apps page
Browse files Browse the repository at this point in the history
  • Loading branch information
adb-sh committed Nov 10, 2024
1 parent 3d5cbb3 commit 9b75bc8
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/routes/cloud/apps/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { CreateServiceForm } from "~/components/cloud/CreateServiceForm";
import { cache, createAsync, A, type RouteDefinition } from "@solidjs/router";
import { getUser } from "~/lib/auth";
import { StatusBadge } from "~/components/cloud/service/StatusBadge";
import humanizeDuration from "humanize-duration";

const getServices = cache(async () => {
"use server";
Expand Down Expand Up @@ -63,11 +64,24 @@ export default () => {
/>
</td>
<td>
{new Date(
service.raw.status.conditions.find(
(condition) => condition.type === "RoutesReady"
).lastTransitionTime
).toLocaleString()}
<div
class="tooltip"
data-tip={new Date(
service.raw.status.conditions.find(
(condition) => condition.type === "Ready"
)?.lastTransitionTime
).toLocaleString()}
>
{humanizeDuration(
new Date(
service.raw.status.conditions.find(
(condition) => condition.type === "Ready"
)?.lastTransitionTime
).getTime() - Date.now(),
{ round: true, largest: 1 }
)}{" "}
ago
</div>
</td>
<td class="hidden md:block">
<a class="link" href={service.raw.status.url}>
Expand Down

0 comments on commit 9b75bc8

Please sign in to comment.