{date-filter}
Plugin: Reporting Plugin, from version 1.0
This filter will ensure that the specified 'prefix:key' value is a date, and that it matches the required criteria.
Description
This macro must be used in a reporter macro.
Usage
{date-filter:prefix:key|minValue=[date]|maxValue=[date]|format=[date format]|required=true/false}
Parameters
| Name | Required | Default | Description |
|---|---|---|---|
| [default]/key | | The key chain value to filter on. | |
| minValue | | If specified, the date being filtered must be greater than or equal to the specified date. See Date Specifications for more details. | |
| maxValue | | If specified, the date must be less than or equal to the specified date value. See Date Specifications for more details. | |
| format | | If either minValue or maxValue 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". | |
| required | | false
| If set to 'true', the key value must have a value of some sort - it may not be empty. |
| relativeTo | | now
| (Since 3.3.0) By default any relative values in 'minValue' or 'maxValue' are relative to the current instant in time. Set this value to a date to either a fixed date in time. See Date Specifications for more details. |
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.
| Note 'relativeTo' and date injection are available only from Reporting 3.3+. |
Examples
Between two specific dates
*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|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
*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|maxValue=+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}
Discussions