feat: links expiry

This commit is contained in:
Elias Renman
2025-03-25 11:21:08 +01:00
parent ee017c01c4
commit 2a5c3c4154
5 changed files with 17 additions and 4 deletions

View File

@@ -23,7 +23,7 @@
<tr>
<th class="p-3">Shortform</th>
<th class="p-3">Destination</th>
<th class="p-3">Expire date</th>
<th class="p-3">Expires at</th>
<th class="p-3">Actions</th>
</tr>
</thead>

View File

@@ -1,6 +1,7 @@
<script lang="ts">
import { mutateDeleteUrl, type Url } from "@/api/url";
import { Edit, Trash } from "@lucide/svelte";
import { formatRelative } from "date-fns";
let { row }: { row: Url } = $props();
@@ -33,7 +34,10 @@
></td
>
<td class="p-3 truncate"
>{row.ttl ? new Date(row.ttl).toLocaleTimeString() : "Never"}</td
>{row.ttl
? // Manually specifying Z at the end here since the date format saved in the database removes timezone info but we know it is saved as UTC+0
formatRelative(new Date(row.ttl + "Z"), new Date(), {})
: "Never"}</td
>
<td class="p-3 flex gap-3">
<button