{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "format",
  "title": "Format",
  "description": "en-US formatting for numbers, compact numbers, currency, percentages from ratios, signed differences with a real minus, percentage points, UTC date ranges and details joined with a middle dot.",
  "files": [
    {
      "path": "registry/lib/dashboardblocks/format.ts",
      "content": "const LOCALE = 'en-US'\nconst MINUS = '−'\n\nconst cache = new Map<string, Intl.NumberFormat>()\n\nfunction numberFormat(options: Intl.NumberFormatOptions) {\n  const key = JSON.stringify(options)\n  let format = cache.get(key)\n  if (!format) {\n    format = new Intl.NumberFormat(LOCALE, options)\n    cache.set(key, format)\n  }\n  return format\n}\n\ninterface FormatOptions {\n  /** @default 1 */\n  maximumFractionDigits?: number\n  /** @default 0 */\n  minimumFractionDigits?: number\n}\n\nfunction formatNumber(value: number, options: FormatOptions = {}) {\n  return numberFormat({ maximumFractionDigits: 1, ...options }).format(value)\n}\n\n/** A whole count, such as a balance of credits, with a real minus below 0: `−1,250`. */\nfunction formatCount(value: number) {\n  const rounded = Math.round(value)\n  const text = numberFormat({ maximumFractionDigits: 0 }).format(Math.abs(rounded))\n  return rounded < 0 ? `${MINUS}${text}` : text\n}\n\nfunction formatCompact(value: number) {\n  return numberFormat({ maximumFractionDigits: 1, notation: 'compact' }).format(value)\n}\n\n/**\n * How many decimals a money metric shows. It's chosen for the metric, never for the value, so a column never mixes `$49.00` with `$2,240`.\n * - `whole`: `$48,290`, for totals, MRR and KPIs.\n * - `exact`: the currency's minor units, `$49.00` (`¥4,900`), for an amount someone pays, is owed or is charged: invoices, payments, prices, line items.\n * - `fine`: `exact`, with amounts under one unit to two significant digits (`$0.42`, `$0.0042`), for per-request costs.\n */\ntype CurrencyPrecision = 'whole' | 'exact' | 'fine'\n\ninterface CurrencyOptions {\n  /** `$48K` instead of `$48,290`. */\n  compact?: boolean\n  /** @default 'USD' */\n  currency?: string\n  /** @default 'whole' */\n  precision?: CurrencyPrecision\n}\n\nfunction getCurrencyDigits(currency = 'USD') {\n  return (\n    numberFormat({ currency, style: 'currency' }).resolvedOptions()\n      .maximumFractionDigits ?? 2\n  )\n}\n\n/** A money value in the currency's smallest unit, rounded half away from zero: $1.005 is 101 cents. */\nfunction toMinorUnits(value: number, currency = 'USD') {\n  const scale = 10 ** getCurrencyDigits(currency)\n  // The epsilon keeps 1.005 from rounding down because it's stored as 1.00499…\n  return Math.sign(value) * Math.round(Math.abs(value) * scale + 1e-6)\n}\n\n/** The symbol written before an amount: `$` for USD, `€` for EUR, `£` for GBP. */\nfunction getCurrencySymbol(currency = 'USD') {\n  return (\n    numberFormat({ currency, currencyDisplay: 'narrowSymbol', style: 'currency' })\n      .formatToParts(0)\n      .find((part) => part.type === 'currency')?.value ?? currency\n  )\n}\n\nfunction currencyDigits(value: number, currency: string, precision: CurrencyPrecision) {\n  if (precision === 'whole') return 0\n  const digits = getCurrencyDigits(currency)\n  const rounded = Math.abs(Number(value.toPrecision(2)))\n  if (precision === 'exact' || rounded === 0 || rounded >= 1) return digits\n  return Math.max(digits, 1 - Math.floor(Math.log10(rounded)))\n}\n\nfunction formatCurrency(value: number, options: CurrencyOptions = {}) {\n  const { compact = false, currency = 'USD', precision = 'whole' } = options\n  if (compact) {\n    return numberFormat({\n      currency,\n      maximumFractionDigits: 1,\n      minimumFractionDigits: 0,\n      notation: 'compact',\n      style: 'currency',\n    }).format(value)\n  }\n  const digits = currencyDigits(value, currency, precision)\n  return numberFormat({\n    currency,\n    maximumFractionDigits: digits,\n    minimumFractionDigits: digits,\n    style: 'currency',\n  }).format(value)\n}\n\nconst ordinalRules = new Intl.PluralRules(LOCALE, { type: 'ordinal' })\nconst ordinalSuffixes: Record<Intl.LDMLPluralRule, string> = {\n  few: 'rd',\n  many: 'th',\n  one: 'st',\n  other: 'th',\n  two: 'nd',\n  zero: 'th',\n}\n\n/** `1st`, `2nd`, `23rd`. */\nfunction formatOrdinal(value: number) {\n  return `${formatNumber(value, { maximumFractionDigits: 0 })}${ordinalSuffixes[ordinalRules.select(value)]}`\n}\n\nconst listFormat = new Intl.ListFormat(LOCALE, { style: 'long', type: 'conjunction' })\nconst orListFormat = new Intl.ListFormat(LOCALE, { style: 'long', type: 'disjunction' })\n\n/** `Ada`, `Ada and Lin`, `Ada, Lin, and Sam`. */\n/** Joins with \"and\", or with \"or\" for choices: `formatList(['Germany', 'France'], 'or')`. */\nfunction formatList(items: string[], joiner: 'and' | 'or' = 'and') {\n  return (joiner === 'or' ? orListFormat : listFormat).format(items)\n}\n\n/** Takes a ratio: `0.125` is `12.5%`. */\nfunction formatPercent(ratio: number, options: FormatOptions = {}) {\n  return numberFormat({ maximumFractionDigits: 1, style: 'percent', ...options }).format(\n    ratio,\n  )\n}\n\n/** One part's share of a whole: `<0.1%` for a sliver, and a second decimal between 99% and 100%, where `99.5%` can't tell `99.46%` from `99.54%`. */\nfunction formatShare(ratio: number) {\n  if (ratio > 0 && ratio < 0.001) return `<${formatPercent(0.001)}`\n  return formatPercent(ratio, {\n    maximumFractionDigits: ratio > 0.99 && ratio < 1 ? 2 : 1,\n  })\n}\n\n/** A difference with its sign, written with a real minus: `+12`, `−3.5`, `0`. */\nfunction formatSigned(value: number, format: (value: number) => string = formatNumber) {\n  if (value === 0) return format(0)\n  return `${value > 0 ? '+' : MINUS}${format(Math.abs(value))}`\n}\n\n/** Percentage points: `1.2 pts`, `1 pt`. */\nfunction formatPoints(value: number, options: FormatOptions = {}) {\n  const text = formatNumber(value, options)\n  return `${text} ${Math.abs(value) === 1 ? 'pt' : 'pts'}`\n}\n\nconst dateCache = new Map<string, Intl.DateTimeFormat>()\n\nfunction dateFormat(options: Intl.DateTimeFormatOptions) {\n  const key = JSON.stringify(options)\n  let format = dateCache.get(key)\n  if (!format) {\n    format = new Intl.DateTimeFormat(LOCALE, options)\n    dateCache.set(key, format)\n  }\n  return format\n}\n\n/** An instant (a `Date`, a timestamp in milliseconds or an ISO string), or a `YYYY-MM-DD` calendar day. */\ntype DateInput = Date | number | string\n\nconst isCalendarDay = (date: DateInput): date is string =>\n  typeof date === 'string' && /^\\d{4}-\\d{2}-\\d{2}$/.test(date)\n\n/** A `YYYY-MM-DD` string is that calendar day, at midnight UTC; any other date string is an instant. */\nfunction toDate(date: DateInput) {\n  if (date instanceof Date) return date\n  if (typeof date === 'number') return new Date(date)\n  return new Date(isCalendarDay(date) ? `${date}T00:00:00Z` : date)\n}\n\ninterface ZonedParts {\n  day: number\n  hour: number\n  minute: number\n  /** 1 to 12. */\n  month: number\n  second: number\n  year: number\n}\n\n/** The wall-clock reading of an instant in `timeZone`, for date math. A `YYYY-MM-DD` string is that day in every zone. */\nfunction zonedParts(date: DateInput, timeZone: string): ZonedParts {\n  const parts = dateFormat({\n    day: 'numeric',\n    hour: 'numeric',\n    hourCycle: 'h23',\n    minute: 'numeric',\n    month: 'numeric',\n    second: 'numeric',\n    timeZone: isCalendarDay(date) ? 'UTC' : timeZone,\n    year: 'numeric',\n  }).formatToParts(toDate(date))\n  const part = (type: Intl.DateTimeFormatPartTypes) =>\n    Number(parts.find((candidate) => candidate.type === type)?.value)\n  return {\n    day: part('day'),\n    hour: part('hour'),\n    minute: part('minute'),\n    month: part('month'),\n    second: part('second'),\n    year: part('year'),\n  }\n}\n\nconst pad = (value: number) => String(value).padStart(2, '0')\n\n/** The `YYYY-MM-DD` day an instant falls on in `timeZone`. */\nfunction dayIn(date: DateInput, timeZone: string) {\n  const { day, month, year } = zonedParts(date, timeZone)\n  return `${year}-${pad(month)}-${pad(day)}`\n}\n\n/** The canonical IANA name for `timeZone` (`America/New_York`), or `null` when this runtime doesn't know it. Without one, the runtime's own zone. */\nfunction resolveTimeZone(timeZone?: string) {\n  try {\n    return dateFormat(timeZone === undefined ? {} : { timeZone }).resolvedOptions()\n      .timeZone\n  } catch {\n    return null\n  }\n}\n\ntype HourCycle = 'h12' | 'h23'\n\n/**\n * The clock `locale` reads: `h23` for 15:42, `h12` for 3:42 PM. Without one, the runtime's own\n * locale, which differs between a server and a browser: read it after hydration.\n */\nfunction resolveHourCycle(locale?: string): HourCycle {\n  const cycle = new Intl.DateTimeFormat(locale, { hour: 'numeric' }).resolvedOptions()\n    .hourCycle\n  return cycle === 'h11' || cycle === 'h12' ? 'h12' : 'h23'\n}\n\n/** Whether `timeZone` is an IANA name this runtime knows, such as `Europe/London`. */\nfunction isTimeZone(timeZone: string) {\n  return resolveTimeZone(timeZone) !== null\n}\n\n/** The zone's offset from GMT at `date`: `GMT-5`, `GMT+5:30`, `GMT`. */\nfunction formatTimeZoneOffset(date: DateInput, timeZone: string) {\n  const offset = dateFormat({ timeZone, timeZoneName: 'shortOffset' })\n    .formatToParts(toDate(date))\n    .find((part) => part.type === 'timeZoneName')?.value\n  // ICU 78 (Node 26, Chrome 153) writes a zero offset as `GMT+0`, earlier versions as `GMT`.\n  return !offset || offset === 'GMT+0' ? 'GMT' : offset\n}\n\n/** `Dec 14` in `now`'s year, `Dec 14, 2026` in another or without `now`. An instant is read in `timeZone`; a `YYYY-MM-DD` string is that day. */\nfunction formatDay(date: DateInput, now?: DateInput, timeZone = 'UTC') {\n  const zone = isCalendarDay(date) ? 'UTC' : timeZone\n  const year = (value: DateInput) => dayIn(toDate(value), zone).slice(0, 4)\n  const sameYear = now !== undefined && year(date) === year(now)\n  return formatDate(date, sameYear ? 'day' : 'date', zone)\n}\n\nconst DATE_STYLES = {\n  /** `15:42:07`, a 24-hour clock with seconds, for logs, traces and audit trails. */\n  clock: { hour: '2-digit', hourCycle: 'h23', minute: '2-digit', second: '2-digit' },\n  /** `15:42:07 UTC` */\n  'clock-zone': {\n    hour: '2-digit',\n    hourCycle: 'h23',\n    minute: '2-digit',\n    second: '2-digit',\n    timeZoneName: 'short',\n  },\n  /** `Dec 14, 2026` */\n  date: { day: 'numeric', month: 'short', year: 'numeric' },\n  /** `Dec 14, 2026, 15:42:07 UTC`, an event in a log someone may compare with another system's. */\n  'date-clock-zone': {\n    day: 'numeric',\n    hour: '2-digit',\n    hourCycle: 'h23',\n    minute: '2-digit',\n    month: 'short',\n    second: '2-digit',\n    timeZoneName: 'short',\n    year: 'numeric',\n  },\n  /** `Dec 14, 2026, 3:42 PM` */\n  'date-time': {\n    day: 'numeric',\n    hour: 'numeric',\n    minute: '2-digit',\n    month: 'short',\n    year: 'numeric',\n  },\n  /** `Dec 14` */\n  day: { day: 'numeric', month: 'short' },\n  /** `Dec 14, 15:42`, a log line from another day. */\n  'day-clock': {\n    day: 'numeric',\n    hour: '2-digit',\n    hourCycle: 'h23',\n    minute: '2-digit',\n    month: 'short',\n  },\n  /** `Dec 14, 3:42 PM` */\n  'day-time': { day: 'numeric', hour: 'numeric', minute: '2-digit', month: 'short' },\n  /** `3 PM`, an hour of the day on its own, such as a bar in a chart of the day's hours. */\n  hour: { hour: 'numeric' },\n  /** `Oct` */\n  month: { month: 'short' },\n  /** `October` */\n  'month-long': { month: 'long' },\n  /** `October 2026` */\n  'month-long-year': { month: 'long', year: 'numeric' },\n  /** `Oct 2026` */\n  'month-year': { month: 'short', year: 'numeric' },\n  /** `3:42 PM` */\n  time: { hour: 'numeric', minute: '2-digit' },\n  /** `15:42`, for someone who reads a 24-hour clock. */\n  'time-24': { hour: '2-digit', hourCycle: 'h23', minute: '2-digit' },\n  /** `15:42 UTC`, an incident or a log line read across zones. */\n  'time-24-zone': {\n    hour: '2-digit',\n    hourCycle: 'h23',\n    minute: '2-digit',\n    timeZoneName: 'short',\n  },\n  /** `3:42 PM UTC` */\n  'time-zone': { hour: 'numeric', minute: '2-digit', timeZoneName: 'short' },\n  /** `Mon` */\n  weekday: { weekday: 'short' },\n  /** `Mon, Dec 14` */\n  'weekday-day': { day: 'numeric', month: 'short', weekday: 'short' },\n  /** `Mon, 3:42 PM`, a time later this week. */\n  'weekday-time': { hour: 'numeric', minute: '2-digit', weekday: 'short' },\n  /** `Mon, Dec 14, 2026` */\n  'weekday-date': { day: 'numeric', month: 'short', weekday: 'short', year: 'numeric' },\n  /** `Mon, Dec 14, 3:42 PM` */\n  'weekday-day-time': {\n    day: 'numeric',\n    hour: 'numeric',\n    minute: '2-digit',\n    month: 'short',\n    weekday: 'short',\n  },\n  /** `Mon, Dec 14, 3:42 PM UTC`, a handover or a deadline people in other zones read. */\n  'weekday-day-time-zone': {\n    day: 'numeric',\n    hour: 'numeric',\n    minute: '2-digit',\n    month: 'short',\n    timeZoneName: 'short',\n    weekday: 'short',\n  },\n  /** `Dec 14, 15:42 UTC` */\n  'day-clock-zone': {\n    day: 'numeric',\n    hour: '2-digit',\n    hourCycle: 'h23',\n    minute: '2-digit',\n    month: 'short',\n    timeZoneName: 'short',\n  },\n  /** `Monday` */\n  'weekday-long': { weekday: 'long' },\n  /** `Monday, Dec 14` */\n  'weekday-long-day': { day: 'numeric', month: 'short', weekday: 'long' },\n  /** `M` */\n  'weekday-narrow': { weekday: 'narrow' },\n  /** `2026` */\n  year: { year: 'numeric' },\n} satisfies Record<string, Intl.DateTimeFormatOptions>\n\ntype DateStyle = keyof typeof DATE_STYLES\n\n/** Writes a date in one of the library's styles, read in `timeZone`. A `YYYY-MM-DD` string is that day in any zone. */\nfunction formatDate(date: DateInput, style: DateStyle, timeZone = 'UTC') {\n  return (\n    dateFormat({\n      ...DATE_STYLES[style],\n      timeZone: isCalendarDay(date) ? 'UTC' : timeZone,\n    })\n      .format(toDate(date))\n      // Some ICU versions put a narrow no-break space before AM and PM; the server's and the browser's text must match.\n      .replace(/\\u202f/g, ' ')\n  )\n}\n\ninterface DateRangeOptions {\n  /** `' to '` in a sentence. @default ' – ' */\n  joiner?: string\n  /** @default 'UTC' */\n  timeZone?: string\n  /** Ends a range within one year with it too: `Mar 3 – 9, 2026`. */\n  year?: boolean\n}\n\n/** `Mar 3 – 9`, `Mar 28 – Apr 3`, `Dec 28, 2025 – Jan 3, 2026`. */\nfunction formatDateRange(\n  { end, start }: { end: Date; start: Date },\n  { joiner = ' – ', timeZone = 'UTC', year = false }: DateRangeOptions = {},\n) {\n  const from = zonedParts(start, timeZone)\n  const to = zonedParts(end, timeZone)\n  if (from.year !== to.year) {\n    return `${formatDate(start, 'date', timeZone)}${joiner}${formatDate(end, 'date', timeZone)}`\n  }\n  const first = formatDate(start, 'day', timeZone)\n  const range =\n    from.month !== to.month\n      ? `${first}${joiner}${formatDate(end, 'day', timeZone)}`\n      : from.day !== to.day\n        ? `${first}${joiner}${to.day}`\n        : first\n  return year ? `${range}, ${to.year}` : range\n}\n\n/** Two times of day joined by an en dash, such as `16:00 – 17:00`, each in `style`. */\nfunction formatTimeRange(\n  { end, start }: { end: DateInput; start: DateInput },\n  style: 'time' | 'time-24',\n  timeZone = 'UTC',\n) {\n  return `${formatDate(start, style, timeZone)} – ${formatDate(end, style, timeZone)}`\n}\n\nconst MINUTE = 60_000\nconst HOUR = 60 * MINUTE\nconst DAY = 24 * HOUR\n\nconst relativeCache = new Map<string, Intl.RelativeTimeFormat>()\n\nfunction relativeFormat(style: Intl.RelativeTimeFormatStyle) {\n  let format = relativeCache.get(style)\n  if (!format) {\n    format = new Intl.RelativeTimeFormat(LOCALE, { numeric: 'auto', style })\n    relativeCache.set(style, format)\n  }\n  return format\n}\n\n/** Calendar days from `now` to `date` in `timeZone`: `-1` is yesterday. A `YYYY-MM-DD` string is that day wherever the reader is. */\nfunction daysBetween(now: DateInput, date: DateInput, timeZone: string) {\n  return Math.round(\n    (Date.parse(dayIn(date, timeZone)) - Date.parse(dayIn(now, timeZone))) / DAY,\n  )\n}\n\n/** A count of calendar days from today: `today`, `tomorrow`, `in 12 days`, `3 days ago`. */\nfunction formatRelativeDays(days: number, style: Intl.RelativeTimeFormatStyle = 'long') {\n  return relativeFormat(style).format(days, 'day')\n}\n\n/** A heading for a day of a list or an agenda: `Today`, `Yesterday`, `Tomorrow`, then `Monday, Dec 14`. */\nfunction formatDayHeading(date: DateInput, now: Date, timeZone = 'UTC') {\n  const days = daysBetween(now, toDate(date), isCalendarDay(date) ? 'UTC' : timeZone)\n  if (days === 0) return 'Today'\n  if (days === -1) return 'Yesterday'\n  if (days === 1) return 'Tomorrow'\n  return formatDate(date, 'weekday-long-day', timeZone)\n}\n\n/**\n * When something starts again, to follow \"resets\": `at 4:00 PM` today, `Wednesday at 1:00 PM` in\n * the next six days, then `Nov 13 at 1:00 PM`, where a weekday would read as today.\n * Pass a fixed `now`, so the server and the browser write the same text.\n */\nfunction formatResetTime(date: DateInput, now: Date, timeZone = 'UTC') {\n  const time = formatDate(date, 'time', timeZone)\n  const days = daysBetween(now, date, timeZone)\n  if (days <= 0) return `at ${time}`\n  const day = formatDate(date, days < 7 ? 'weekday-long' : 'day', timeZone)\n  return `${day} at ${time}`\n}\n\ninterface RelativeTimeOptions {\n  /** Counts the last minute in seconds, `12 sec. ago`, for something that updates live, such as when data last arrived. `just now` stays for the first 5. */\n  seconds?: boolean\n  /** @default 'short' */\n  style?: Intl.RelativeTimeFormatStyle\n  /** @default 'UTC' */\n  timeZone?: string\n}\n\n/**\n * How long ago or how soon, past or future: `just now`, `5 min. ago`, `in 3 hr.`, `3:42 PM` earlier today, `yesterday`, `in 3 days`, then the day (`Oct 6`).\n * Pass a fixed `now`, so the server and the browser write the same text.\n */\nfunction formatRelativeTime(\n  date: DateInput,\n  now: Date,\n  { seconds = false, style = 'short', timeZone = 'UTC' }: RelativeTimeOptions = {},\n) {\n  const instant = toDate(date)\n  const difference = instant.getTime() - now.getTime()\n  const sign = difference < 0 ? -1 : 1\n  const elapsed = Math.abs(difference)\n  const format = relativeFormat(style)\n  if (seconds && difference <= 0 && elapsed >= 5000 && elapsed < MINUTE)\n    return format.format(-Math.floor(elapsed / 1000), 'second')\n  if (elapsed < MINUTE) return difference <= 0 ? 'just now' : format.format(1, 'minute')\n  if (elapsed < HOUR) return format.format(sign * Math.floor(elapsed / MINUTE), 'minute')\n  if (elapsed < 12 * HOUR) return format.format(sign * Math.floor(elapsed / HOUR), 'hour')\n  const days = daysBetween(now, instant, timeZone)\n  if (days === 0) return formatDate(instant, 'time', timeZone)\n  if (Math.abs(days) < 7) return format.format(days, 'day')\n  return formatDay(instant, now, timeZone)\n}\n\ninterface DurationOptions {\n  /** `minute` drops the seconds, for time tracked on work: `2 h 59 min`, `0 min`. @default 'millisecond' */\n  smallest?: 'millisecond' | 'minute'\n  /** `rough` gives one unit up to days, with one decimal under 10, for a typical wait such as a median: `6 min`, `4.5 h`, `1.8 days`. @default 'exact' */\n  style?: 'exact' | 'rough'\n}\n\nfunction roughDuration(ms: number) {\n  const units: [number, string, string][] = [\n    [86_400_000, 'day', 'days'],\n    [3_600_000, 'h', 'h'],\n    [60_000, 'min', 'min'],\n    [1000, 's', 's'],\n  ]\n  const [size, one, many] = units.find(([size]) => ms >= size) ?? units[units.length - 1]\n  const amount = ms / size\n  const value = amount < 10 ? Math.floor(amount * 10) / 10 : Math.floor(amount)\n  return `${value}\\u00a0${value === 1 ? one : many}`\n}\n\n/** A length of time from milliseconds, for thinking, tool calls and runs: `640 ms`, `4.2 s`, `2 min 5 s`, `1 h 20 min`; or roughly, `1.8 days`. */\nfunction formatDuration(\n  ms: number,\n  { smallest = 'millisecond', style = 'exact' }: DurationOptions = {},\n) {\n  if (style === 'rough') return roughDuration(ms)\n  const unit = (value: number, name: string) => `${value}\\u00a0${name}`\n  if (smallest === 'minute' && ms < 60_000) return unit(0, 'min')\n  if (ms < 1000) return unit(Math.floor(ms), 'ms')\n  if (ms < 10_000) return unit(Math.floor(ms / 100) / 10, 's')\n  const seconds = Math.floor(ms / 1000)\n  if (seconds < 60) return unit(seconds, 's')\n  const minutes = Math.floor(seconds / 60)\n  if (minutes < 60) {\n    const rest = smallest === 'minute' ? 0 : seconds % 60\n    return rest ? `${unit(minutes, 'min')} ${unit(rest, 's')}` : unit(minutes, 'min')\n  }\n  const hours = Math.floor(minutes / 60)\n  const rest = minutes % 60\n  return rest ? `${unit(hours, 'h')} ${unit(rest, 'min')}` : unit(hours, 'h')\n}\n\n/** A running timer from milliseconds, hours first: `0:04:09`, `2:59:58`, `12:00:00`. */\nfunction formatTimer(ms: number) {\n  const seconds = Math.max(0, Math.floor(ms / 1000))\n  const hours = Math.floor(seconds / 3600)\n  return `${hours}:${pad(Math.floor(seconds / 60) % 60)}:${pad(seconds % 60)}`\n}\n\n/** Time left on a countdown, rounded up to the second so it reaches `0:00` only when the time is up: `4:12`, `0:09`, `1:04:09`. */\nfunction formatCountdown(ms: number) {\n  const seconds = Math.max(0, Math.ceil(ms / 1000))\n  const hours = Math.floor(seconds / 3600)\n  const minutes = Math.floor(seconds / 60) % 60\n  const rest = pad(seconds % 60)\n  return hours > 0 ? `${hours}:${pad(minutes)}:${rest}` : `${minutes}:${rest}`\n}\n\n/** Joins the parts that are set with ` · `. */\nfunction joinDetails(...parts: (string | false | null | undefined)[]) {\n  return parts.filter(Boolean).join(' · ')\n}\n\nexport {\n  formatCount,\n  dayIn,\n  daysBetween,\n  formatCompact,\n  formatCountdown,\n  formatCurrency,\n  formatDate,\n  formatDateRange,\n  formatDay,\n  formatDayHeading,\n  formatDuration,\n  formatList,\n  formatNumber,\n  formatOrdinal,\n  formatPercent,\n  formatShare,\n  formatPoints,\n  formatRelativeDays,\n  formatRelativeTime,\n  formatResetTime,\n  formatSigned,\n  formatTimeRange,\n  formatTimer,\n  formatTimeZoneOffset,\n  getCurrencyDigits,\n  getCurrencySymbol,\n  isTimeZone,\n  joinDetails,\n  resolveHourCycle,\n  resolveTimeZone,\n  toMinorUnits,\n  zonedParts,\n}\n\nexport type {\n  CurrencyOptions,\n  DateRangeOptions,\n  CurrencyPrecision,\n  DateInput,\n  DateStyle,\n  DurationOptions,\n  FormatOptions,\n  HourCycle,\n  RelativeTimeOptions,\n  ZonedParts,\n}\n",
      "type": "registry:lib",
      "target": "@lib/dashboardblocks/format.ts"
    }
  ],
  "type": "registry:lib"
}
