~ knotless Search/
↑↓ move↵ open⇧↵ all results

chadtmiller.com/hud

A remote MCP server that shows atproto records as interactive UI inside MCP Apps hosts

0
0
17 lines · 601 B Raw History
<script lang="ts">
	import { formatDateTime } from '@hud/renderer';

	/** A moment, said as how long ago, and in full on hover. */
	let { at }: { at: string } = $props();

	const ago = $derived.by(() => {
		const seconds = (Date.now() - Date.parse(at)) / 1000;
		if (!Number.isFinite(seconds)) return at;
		if (seconds < 60) return 'just now';
		if (seconds < 3600) return `${Math.floor(seconds / 60)}m ago`;
		if (seconds < 86400) return `${Math.floor(seconds / 3600)}h ago`;
		return `${Math.floor(seconds / 86400)}d ago`;
	});
</script>

<time datetime={at} title={formatDateTime(at)}>{ago}</time>