Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
Svelte
12345678910111213141516171819<script lang="ts"> import { compactRelativeTime, formatDateTime, relativeTime } from "$lib/format";
interface Props { value: string | Date; variant?: "compact" | "full"; class?: string; }
let { value, variant = "compact", class: className }: Props = $props();
const text = $derived(variant === "compact" ? compactRelativeTime(value) : relativeTime(value)); const iso = $derived(typeof value === "string" ? value : value.toISOString());</script>
{#if text} <time datetime={iso} title={formatDateTime(value)} class={className}>{text}</time>{/if}