--- import BreweryRow from '../components/BreweryRow.astro'; import { getSiteData } from '../lib/aggregate'; import { TZ, dayKey, formatTime } from '../lib/time'; import '../styles/site.css'; const data = await getSiteData(); const now = new Date(data.generatedAt); const today = dayKey(now); const parts = new Intl.DateTimeFormat('en-US', { timeZone: TZ, weekday: 'short', hour: 'numeric', minute: 'numeric', hourCycle: 'h23' }).formatToParts(now); const dow = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'].indexOf(parts.find((p) => p.type === 'weekday')!.value); const minutes = Number(parts.find((p) => p.type === 'hour')!.value) * 60 + Number(parts.find((p) => p.type === 'minute')!.value); const longDate = new Intl.DateTimeFormat('en-US', { timeZone: TZ, weekday: 'long', month: 'long', day: 'numeric' }).format(now); const countToday = (kind: 'food' | 'event') => data.breweries.reduce((n, b) => n + b.items.filter((i) => i.kind === kind && (i.allDay ? i.start : dayKey(i.start)) === today).length, 0); const trucks = countToday('food'); const events = countToday('event'); const plural = (n: number, one: string, many: string) => `${n} ${n === 1 ? one : many}`; --- gnv.beer — Gainesville breweries today

gnv.beer

{longDate}

{plural(trucks, 'food truck', 'food trucks')} and {plural(events, 'event', 'events')} at {data.breweries.length} breweries today.

{data.breweries.map((b) => )}