---
name: DateGranularity
lang: cpp
domain: core
version: "1.0.0"
algebraic: sum
definition: |
  enum class DateGranularity { None, Year, Month, Week, Day, Hour };
description: "Granularidad de truncado de fechas para breakouts TQL. Sufijo `:token` en breakout string (ej. 'ts:month')."
tags: [tql, date, granularity, sum-type, mbql]
uses_types: []
file_path: "cpp/functions/core/data_table_types.h"
---

## Notas

Auto-detect via `auto_date_granularity(min_ymd, max_ymd)`: >2y→Year, >60d→Month, >14d→Week, resto→Day. SQL emit DuckDB: `date_trunc('month'|'year'|...,col)`.

Week trunca a lunes ISO (Hinnant algo).
