Skip to content

Relative dates

You can set a relative date as the default value of a date input or date range. Values are defined as an offset from a reference date, such as "today," "yesterday," or "last week."

The unit of the offset follows the parameter setting's unit (day / week / month / year). For example, when unit is day, an offset of 0 means today and -1 means yesterday. When unit is week, an offset of 0 means this week and -1 means last week.

As described in Resolving values and default values, a relative date is calculated into a concrete date and written into the current value when reset. It isn't recalculated automatically on every run.

Configuring

  1. Open the menu at the top right of the parameter's input form.
  2. Under Default value, choose Relative date or Relative date range.
  3. Specify the offset (for date range, lower bound offset / upper bound offset).

When relative dates are calculated

A relative date is calculated when the parameter value is reset to its default. When this is applied differs by feature, as follows.

Notebook

Applied on the following operations.

  • Reset parameter values to default for the whole form.
  • Reset to default value for an individual parameter.

TIP

In a notebook, parameter changes are shared in real time with other users. Resetting to the default value requires an explicit operation. Simply opening a notebook doesn't recalculate relative dates.

Relative dates aren't available, since parameters can't be changed. See Public link for details.

Report

With the following publish settings, relative dates are applied when the report is opened.

  • Choose Interactive report as the report type.
  • Enable Enable auto-run, and also enable Use parameter default values.

If Use parameter default values is disabled, the parameter value is the value at the time of publishing. Resetting from the input form behaves the same as in a notebook.

TIP

Parameter changes in a report aren't shared with other users.

See Report for details.

Signed embed

With the following conditions, relative dates are applied when the signed embed is opened.

  • The parameter is set as a client-side parameter (not a server-side parameter).
  • For the client-side parameter, the setting is configured to use the parameter's default value as the initial value.

If this setting is disabled, the parameter value is the value at the time of publishing. Relative dates aren't available for server-side parameters. If you need to specify a date on the server side, you need to calculate the relative date separately.

Resetting from the input form behaves the same as in a notebook. However, a parameter whose input form is hidden isn't subject to reset, so its relative date isn't recalculated.

TIP

Parameter changes in a signed embed aren't shared with other users.

See Signed embed for details.

Reference time for calculation

Relative dates are calculated based on the browser's current time. The timezone follows the browser's setting. Because of this, the resulting date for the same moment might differ depending on timezone.