Skip to content

Date Range V2

beta
Don't use in production

DateRangeV2 stores { range, timezone, from, to }. range is the source of truth: relative, calendar, fixed, or preset. from and to are the epochs for that range. Apply fills them. resolveDateRangeV2 does that for every range except a preset, which uses getRange. Weeks start on Monday. Relative, calendar, and fixed drafts stay independent, so switching tabs does not convert one range into another.

Standalone

Omit config for the defaults. The tabs are Relative, Calendar, and Fixed. Direction is any time. Clear is shown once a value is stored, and it unsets that value. The timezone row stays hidden until timezone is an object. The default zone is UTC. label on a mode entry replaces the tab title. tabDetails adds a description, an example, or a note under each title. Omit it to leave the title only.

The picker below starts with no config. Open Config builder to change it. Each box is one field, and a selected mode’s settings are nested inside modes. Generated config lists only the fields that differ from these defaults. Open it to copy the object the picker is using.

Custom presets

Include { mode: 'presets', presets } in modes to add that tab. Put it first to show it ahead of the other modes. presets is required on that object. { mode: 'presets', presets: [] } shows an empty preset select. Each preset uses the date range picker shape: label, value, getRange, and group (recommended, relative, or calendar). The select is grouped by group.

getRange receives { timezone } for the zone selected in the picker. Use that argument when the window should follow the zone. A preset that ignores it keeps its own dates. Apply stores the preset id, that timezone, and the dates from getRange. The same list works on a filter. Put it on filterFieldConfig.modes. The built-in filter parser reloads PRESET_ID|TIMEZONE through getRange. An id in this list wins over a built-in id with the same name.

Filters

Built-in parser

FilterFieldTypes.DateRangeV2 on a FilterGroup uses the built-in parser. Do not pass parser. filterFieldConfig is the same config as the standalone picker. Omit it for Relative, Calendar, and Fixed.

The parser reads and writes one query param. A missing timezone is UTC. Clear writes an empty string, which drops the param and leaves the filter on the bar. The next Apply writes the current grammar.

Relative LAST_7_DAYS|UTC NEXT_2_HOURS|Asia/Kolkata
This period THIS_MONTH|UTC THIS_WEEK_SO_FAR|UTC THIS_DAY_FROM_NOW|UTC
Calendar PREVIOUS_1_CALENDAR_MONTH|UTC NEXT_2_CALENDAR_QUARTERS|UTC
Fixed FIXED|2026-09-05T09:30:00|2026-10-05T09:30:00|UTC
Preset PREVIOUS_3_DAYS|UTC

Amount 1 stays singular (LAST_1_DAY). A larger amount is plural (LAST_7_DAYS). A full current period omits _FULL. Presets on filterFieldConfig.modes use this same parser. The query is the preset id and the timezone, and getRange receives that timezone.

Status below is a multi-select of objects, so that field needs its own parser. Timeframe does not. Add Timeframe, apply a range, and the search string is the query above.

Custom parser

Pass parser only when the query is not the grammar above. The parser has to read and write every mode the picker can apply, and the timezone on each one. This parser keeps a relative range and gives that range to dateRangeV2FilterParser, so Last 7 days in Kolkata round-trips. A calendar period, a fixed range, or a preset serializes to an empty string. Apply clears the query, and a refresh cannot restore it.

Migrations

The built-in parser rewrites an older query before it reads it. A custom parser does not, unless it calls dateRangeV2FilterParser. A preset configured with the same id is matched first, so that preset wins over these rewrites. The next Apply stores the current grammar, so 7d becomes LAST_7_DAYS|UTC.

M is a month and m is a minute. An amount-less LAST_DAY, LAST_WEEK, LAST_MONTH, LAST_QUARTER, or LAST_YEAR becomes the previous calendar period. 0d, 1x, 30d|UTC, and NEXT_MONTH stay unchanged. 30d|UTC is not a short preset id, because it already has a timezone.

API reference

Prop
Required
Default
Type
valuefalseDateRangeV2Value
onValueChangetrue(value: DateRangeV2Value | undefined) => void
configfalseDateRangeV2Config
disabledfalsefalseboolean