This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

core / web / src / lib / components / ui / TimeAgo.svelte
555 B 18 lines
1<script lang="ts"> 2 import { compactRelativeTime, formatDate, relativeTime } from "$lib/format"; 3 4 interface Props { 5 value: string | Date; 6 variant?: "compact" | "full"; 7 class?: string; 8 } 9 10 let { value, variant = "compact", class: className }: Props = $props(); 11 12 const text = $derived(variant === "compact" ? compactRelativeTime(value) : relativeTime(value)); 13 const iso = $derived(typeof value === "string" ? value : value.toISOString()); 14</script> 15 16{#if text} 17 <time datetime={iso} title={formatDate(value)} class={className}>{text}</time> 18{/if}