Timeframes

Flexible date breakouts

For date fields, you can provide multiple timeframe options directly within the View YAML. Instead of requiring stakeholders to manipulate dates manually, you can pre-define useful breakouts like year, month, or day.

fields:
- name: updated_at
    label: Updated At
    type: date
    timeframes: [year_trunc, quarter_trunc, month_trunc, day_of_week, null]

Here’s a quick reference of all the timeframe options you can use, with explanations for each one.

Option
Description

year_trunc

Rounds down to the first day of the year

quarter_trunc

Rounds down to the first day of the quarter

month_trunc

Rounds down to the first day of the month

week_trunc

Rounds down to the first day of the week

day_trunc

Rounds down to midnight of that day

hour_trunc

Rounds down to the start of the hour

minute_trunc

Rounds down to the start of the minute

second_trunc

Rounds down to the start of the second

year

Extracts the year component

quarter

Extracts the quarter (1-4) of the year

month

Extracts the month (1-12) of the year

week

Extracts the week (1-52) of the year

day_of_year

Extracts the day (1-366) of the year

day_of_month

Extracts the day (1-31) of the month

day_of_week

Extracts the day (0-6) of the week

hour

Extracts the hour (0-23) of the day

minute

Extracts the minute (0-59) of the hour

second

Extracts the second (0-59) of the minute

null

No function is applied

In the canvas UI, timeframes options are revealed by clicking on the expandable field.

Last updated