export interface Period {
  start?: Date
  end?: Date
}

export function isPeriodActive(period?: Period): boolean {
  if (!period) return true // No period means always active
  const now = new Date()
  const start = period.start ? new Date(period.start) : null
  const end = period.end ? new Date(period.end) : null

  const isAfterStart = !start || now >= start
  const isBeforeEnd = !end || now <= end

  return isAfterStart && isBeforeEnd
}
