flotilla/src/app/components/EventItem.svelte

25 lines
841 B
Svelte
Raw Normal View History

2024-09-20 18:00:41 +00:00
<script lang="ts">
import {fromPairs} from "@welshman/lib"
2024-12-09 22:03:59 +00:00
import {formatTimestamp, formatTimestampAsDate, formatTimestampAsTime} from "@welshman/app"
2024-09-20 18:00:41 +00:00
import Icon from "@lib/components/Icon.svelte"
export let event
$: meta = fromPairs(event.tags) as Record<string, string>
$: end = parseInt(meta.end)
$: start = parseInt(meta.start)
$: startDateDisplay = formatTimestampAsDate(start)
$: endDateDisplay = formatTimestampAsDate(end)
$: isSingleDay = startDateDisplay === endDateDisplay
</script>
2024-09-23 20:58:01 +00:00
<div class="card2 flex items-center justify-between gap-2">
2024-09-20 18:00:41 +00:00
<span>{meta.title || meta.name}</span>
<div class="flex items-center gap-2 text-sm">
<Icon icon="clock-circle" size={4} />
2024-12-09 22:03:59 +00:00
{formatTimestampAsTime(start)} — {isSingleDay
? formatTimestampAsTime(end)
: formatTimestamp(end)}
2024-09-20 18:00:41 +00:00
</div>
</div>