sisense.com
✅ You are viewing documentation for the latest version of Compose SDK.
Version:

Function dateRange

dateRange( level, from?, to?, config?): Filter

Creates a filter that keeps rows between a start and an end at the given date level.

Parameters

ParameterTypeDescription
levelLevelAttributeDate LevelAttribute to filter on
from?Date | stringOptional Date or ISO-format string
to?Date | stringOptional Date or ISO-format string
config?BaseFilterConfigOptional configuration for the filter

Returns

Filter

A filter instance

Remarks

Pass JavaScript Date values or ISO-format datetime strings for from and/or to. On YearsDays levels, the time part of each supplied value (from the first T onward) is stripped.

Example

Filter for items in the Sample ECommerce data model where the date is from the years 2009, 2010, or 2011.

filterFactory.dateRange(DM.Commerce.Date.Years, '2009-06-15', '2011-03-20')
// or
filterFactory.dateRange(DM.Commerce.Date.Years, '2009-01-01', '2011-12-31')

With Years, both are equivalent: only the years in from and to drive the range; month and day inside those endpoints do not change which year buckets are included.

One calendar day at day granularity: use the same yyyy-MM-dd for from and to.

filterFactory.dateRange(DM.Commerce.Date.Days, '2012-05-05', '2012-05-05')
Last Updated: