"use client"; import { useEffect, useRef } from "react"; import { useLocale } from "@/components/I18n"; import { intlLocale } from "@peppa/shared/i18n"; /** HH:MM (with the date when not today) in the viewer's time zone; the server renders its own zone first. */ export function LocalTime({ iso }: { iso: string }) { const d = new Date(iso); const loc = intlLocale(useLocale()); const today = new Date().toDateString() === d.toDateString(); const time = d.toLocaleTimeString(loc, { hour: "2-digit", minute: "2-digit" }); return ( ); } /** On narrow screens the side panel sits under the list: bring the chosen runner into view. */ export function ScrollIntoViewOnNarrow({ id }: { id: string | number }) { const ref = useRef(null); useEffect(() => { if (window.matchMedia("(max-width: 1279px)").matches) ref.current?.scrollIntoView({ block: "start" }); }, [id]); return ; }