Dashboard > Atlassian Plugins > ... > Macros > date-filter
  Atlassian Plugins Log In | Sign Up   View a printable version of the current page.  
  date-filter

Added by david , last edited by David Peterson on Mar 04, 2008  (view change) show comment
Labels: 

{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
This can either be a specific date, or a time period. If specified, the date being filtered must be greater than or equal to the specified date. If it is a specific date, it should also match the 'format' parameter, syntactically.
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".
maxValue
This can be either a specific date, or a time period. If specified, the date must be less than or equal to the specified date value. If it is a specific date, it should match the 'format' parameter, syntactically.
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".
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") 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.

See Also

Hi David,

I'm not sure how to formulate time values for the minValue and maxValue. I'm trying to use relative values, specifically. What are the variables for minutes, seconds, etc? It doesn't seem to like "s". And is "m" minutes or months? In your example, m is for month. But in full date formats, M is for month and m is for minute.

What I'm trying to do is show content to the editor of a page immediately after they save it. So I am trying to do a date filter of -60 seconds or -1 minute. Here is my code:

{report-block:injected=true}
  {local-reporter:content:@self}
    {date-filter:content:modification date|maxValue=-1m}
  {local-reporter}
  {report-body}
    {show-to:users=%content:modifier%}{info:title=Last Modified By - %content:modifier%}Page was just modified{info}{show-to}
  {report-body}
  {report-empty}
    {report-on:@self|injected=true}{note:title=Last Modified By - %content:modifier%}Page was NOT just modified{note}{report-on}
  {report-empty}
{report-block}

Thank you for your help!

Shawn

Hi Shawn. I believe there is actually a bug in date-filter presently with any time (as opposed to date) related relative values. In fact, here's the bug report. It's scheduled to be looked at in the next version.

I guess that would explain my troubles.

Thanks!

Hi,

Is it possible to just return the latest created child using date-filter?

Thanks,
David

Not exactly, but you could use the date-sort along with the 'maxResults' parameter of the reports. Eg:

{report-block:maxResults=1}
{local-reporter:content:children}
  {date-sort:content:creation date|order=descending}
{local-reporter}
{report-body}{report-info:title|link=true}{report-body}
{report-block}

David thanks for this worked exactly.

I would like to enhance slightly and whilst question is text-filter is still date related.

This is to filter out child pages that are a months rota which have the month name within the page title.

E.g Page Title = Department August Rota

The following works

{text-filter:content:title|include=.*August.*}

But trying to get Month inserted automatically this doesn't

{text-filter:content:title|include=.*\\x7Bdate\-data\:month,format\=MMMM\\x7DNOW\\x7Bdate\-data\\x7D.*}

Any help greatly appreciated

I'm not exactly sure what you're attempting to do, but I think it's putting a wiki macro in the 'include' parameter value? That won't work. In fact, I'm not sure there's anyway to do exactly what you're after presently. Is the source of the 'month' date value the page being reported on, or the page that the report is on? I'm not exactly sure what you're after...

View the rest of this thread  |  3 more comments by 2 persons
Copyright(c) CustomWare Asia Pacific Pty Ltd
Powered by Atlassian Confluence 2.7.3, the Enterprise Wiki. Bug/feature request - Atlassian news - Contact administrators