Date Range

Block Group: Date Time Operations
Icon: Date Range block icon

The Date Range block returns a formatted date and time range based on the defined formatting options.

For information on using dataflow blocks, see Dataflow.

Tip

You can insert the pre-made date range picker component to enable the user to select a range.


Special Values

Special values can be the following strings:

  • today
  • yesterday
  • thisWeek
  • lastWeek
  • thisMonth
  • lastMonth
  • thisYear
  • lastYear

Input/Output Properties

The following properties of the Date Range block can take input and give output.

  • input (date range)
  • next (trigger)
  • previous (trigger)
  • format (string)
  • rangeDelimiter (string)
  • keepSpecial (enum)

input specifies the currently selected range. You can select a range by clicking the property and using the pop-up window.

next advances the value of the input property to the next range of the same duration.

previous changes the value of the input property to the previous range of the same duration.

format specifies the date and time formatting string used to format the dates and times in this block.

rangeDelimiter specifies the string used to delimit the beginning of the range and the end of the range.

keepSpecial specifies when a special value is used as the output properties, versus when the values of the format and delimiter properties are used. The value of the keepSpecial property can be one of the following:

  • None—The format and delimiter properties are always used, if defined.
  • Raw—The special value is used, if applicable. Otherwise, the format and delimiter properties are used.
  • Formatted—The special value is used, if applicable. Short default formats are automatically used when available. The format and delimiter properties are used when necessary.
  • Format Clean—The special value is used, if applicable. Shortened versions of the format property are used when available.

Output Properties

The following properties of the Date Range block can give output but cannot take input.

  • formatted (string)
  • nextRange (date range)
  • thisRange (date range)
  • previousRange (date range)
  • duration (number)

formatted returns the range, formatted according to the format, rangeDelimiter, and keepSpecial properties.

nextRange returns the next range of the same duration after input.

thisRange returns the currently selected range in input.

previousRange returns the previous range of the same duration before input.

duration returns the duration of the currently selected range, in milliseconds.


Examples

The following image demonstrates the block properties panel for an example of the Date Range block. In this example, a one-week range has been selected and a format has been defined.

Date Range block example

The following image demonstrates a binding from a Date Range block to the dateRange property of a chart axis.

Date Range block example