/** * Trouve-KA — formatage fr-CA (nombres, dates, heures) * Author: Simon-Pierre Boucher * Contact: contact@spboucher.ai */ const numberFormat = new Intl.NumberFormat("fr-CA"); const dateFormat = new Intl.DateTimeFormat("fr-CA", { year: "numeric", month: "long", day: "numeric", }); const timeFormat = new Intl.DateTimeFormat("fr-CA", { hour: "2-digit", minute: "2-digit", second: "2-digit", }); /** Formate un nombre en fr-CA (séparateurs de milliers insécables). */ export function formatNumber(value: number): string { return numberFormat.format(value); } /** Formate une date ISO en date longue fr-CA (ex. « 13 août 2026 »). */ export function formatDate(iso: string): string { const date = new Date(iso); if (Number.isNaN(date.getTime())) return ""; return dateFormat.format(date); } /** Formate une date ISO en heure fr-CA (ex. « 14 h 05 min 12 s »). */ export function formatTime(iso: string): string { const date = new Date(iso); if (Number.isNaN(date.getTime())) return ""; return timeFormat.format(date); }