import type { H2BiDailyResponse } from "./types"; export function formatDailyChange(value: unknown): string { if (typeof value !== "number" || !Number.isFinite(value)) return "环比 —"; return `环比 ${value > 0 ? "+" : ""}${value.toFixed(2)}%`; } /** Export the entire selected range, independently of which branches were opened. */ export function dailySummaryRows(daily: H2BiDailyResponse): Array> { return [ ["日期", "加氢站数", "加氢量(Kg)", "成本(元)"], ["区间合计", daily.kpis.stationCount, daily.kpis.totalKg, daily.kpis.totalCost], ...daily.days.map(day => [day.date, day.stationCount ?? "—", day.kg, day.cost]), ]; }