export const formatDate = (value?: string | null, locale = 'en') => {
  if (!value) return '--'
  return new Date(value).toLocaleString(locale)
}

export const formatCurrency = (value?: number | string, symbol = '$') => {
  if (value === undefined || value === null) return `${symbol}0.00`
  const numeric = typeof value === 'string' ? parseFloat(value) : value
  if (!Number.isNaN(numeric)) {
    return `${symbol}${numeric.toLocaleString('en', { minimumFractionDigits: 2, maximumFractionDigits: 2 })}`
  }
  return `${symbol}0.00`
}
