Make UI language, timestamps and live feedback consistent
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
<script lang="ts">
|
||||
import { browser } from '$app/environment';
|
||||
import { timestampISO, type Timestamp } from '$lib/time-zone.js';
|
||||
import { timeFormat } from '$ui/stores/time-zone.js';
|
||||
import { uiNow } from '$ui/stores/servers.js';
|
||||
|
||||
let { value, missing = '—', class: className }: { value: Timestamp; missing?: string; class?: string } = $props();
|
||||
const iso = $derived(timestampISO(value));
|
||||
const now = $derived(browser ? $uiNow : Date.now());
|
||||
</script>
|
||||
|
||||
{#if iso}<time class={className} datetime={iso} title={$timeFormat.dateTime(value)}>{$timeFormat.relative(value, now)}</time>{:else}<span class={className}>{missing}</span>{/if}
|
||||
Reference in New Issue
Block a user