Date Filter

Description

This filter will ensure that the specified prefix:key value is a date, and that it matches the required criteria.

This macro must be used within a reporter macro.

Parameters

Name

Required

Migratable to Cloud?

Default Value

Description

Name

Required

Migratable to Cloud?

Default Value

Description

[default] /key

 

  • (/)

 

 

  • NO

 

 

The key chain value to filter on.

required

 

  • (X)

 

 

  • NO

 

true

If set to true, the key value must have a value of some sort. It must not be empty.

value

 

  • (X)

 

 

  • NO

 

 

(Since 3.4.0) The key value must be exactly equal to this value, to the millisecond. Either Specific, Relative or Injected.

format

 

  • (X)

 

 

  • NO

 

 

If the value or relativeTo parameters above are set to specific dates, this parameter must also be specified to inform the filter of the Date Format used in those parameters.

It is ignored if a relative date ("-5d") or injected date is being used. This is a standard Date Format.

e.g.: "dd MMM, yyyy". 

minValue

 

  • (X)

 

 

  • NO

 

 

The key value must be greater than or equal to this value. Either Specific, Relative or Injected.

maxValue

 

  • (X)

 

 

  • NO

 

 

The key value must be less than or equal to this value. Either Specific, Relative or Injected.

afterValue

 

  • (X)

 

 

  • NO

 

 

(Since 3.4.0) The key value must be greater than this value. Either Specific, Relative or Injected. 

beforeValue

 

  • (X)

 

 

  • NO

 

 

(Since 3.4.0) The key value must be less than this value. Either Specific, Relative or Injected.

relativeTo

 

  • (X)

 

 

  • NO

 

now

(Since 3.3.0) By default any relative values in the value parameters above are relative to the current instant in time.

Set this value to a date to either a Specific or Injected value.

Editor View

  • Not applicable.

Macro Edit View

  • Not applicable.

Notes

Behavior Change

In Reporting 3.4.0, the default behaviour of 'minValue' and 'maxValue' changed to match that of other filter macros. Previously, setting either value would filter out any records that were blank, but they now allow blank values in addition to set values that match the requirements. After 3.4.0, add 'required=true' to achieve the equivalent behaviour as in 3.3.x and earlier. Eg:{date-filter:page:creation date | minValue=01-Jan-2010 | format=dd-MMM-yyyy | required=true}

Date Specifications

You can specify dates in three ways: a specific date, a relative time period, or an injected date retrieved via a Supplier Key.

  • Specific Date: This allows the specification of a particular date and/or time. It must also have a 'format' parameter, and match that format. For example, '{date-filter:page:creation date|minValue=21-Jan-2012|format=dd-MMM-yyyy}'.

  • Relative Date: If a time period is specified it will be relative to the current date/time. E.g. "-2m 6d" is "2 months and 6 days into the past". "2y 3w" is "2 years and 3 weeks into the future". If the 'relativeTo' parameter is set, the shift will be relative to that date, otherwise, it is relative to the current instant in time.

  • Injected Date: You can also inject a date via %key:value%. The property will be relative to the current context outside the reporter.

'relativeTo' and date injection are available only from Reporting 3.3+.

Examples

Between two specific dates

This matches any values between and including the specified dates, rounding the 'creation date' to midnight so that the 'maxValue' doesn't cut off any records after midnight on the specified 'To' date.

*From:* {date-data:From|format=dd-MMM-yyyy} *To:* {date-data:To|format=dd-MMM-yyyy} {report-table} {local-reporter:page:children|source=Home} {date-filter:page:creation date > date:at midnight|minValue=%data:From%|maxValue=%data:To%} {local-reporter} {report-column:title=Page}{report-info:page:title|link=true}{report-column} {report-column:title=Creation Date}{report-info:page:creation date|format=dd-MMM-yyyy}{report-column} {report-table}

+1 Month relative to a date (exclusive)

We use 'minValue' to include the first day and 'beforeValue' to exclude the last day, so that we don't include values from the first day of the next month.Relative To: {date-data:Relative To|format=dd-MMM-yyyy}

{report-table} {local-reporter:page:children|source=Home} {date-filter:page:creation date|relativeTo=%data:Relative To%|minValue=+0m|beforeValue=+1m} {local-reporter} {report-column:title=Page}{report-info:page:title|link=true}{report-column} {report-column:title=Creation Date}{report-info:page:creation date|format=dd-MMM-yyyy}{report-column} {report-table}

Any time on a particular day

This matches any records with a Scaffolding 'Due Date' value set to any time today. It uses 'at midnight' to round any values to the nearest day.

{report-table} {local-reporter:page:children|source=Home} {date-filter:data:Due Date > date:at midnight|value=%global:current date > date:at midnight|required=true|format=dd-MMM-yyyy} {local-reporter} {report-column:title=Page}{report-info:page:title|link=true}{report-column} {report-column:title=Creation Date}{report-info:page:creation date|format=dd-MMM-yyyy}{report-column} {report-table}

Tutorial Examples