1 [[!meta author="spalax"]]
2 [[!template id=plugin name=datetime_cmp author="[[Louis|spalax.]]"]]
7 This plugin provides a family of
8 [pagespec](http://ikiwiki.info/ikiwiki/pagespec/) matching pages according to
9 creation or modification times.
11 It also sets the date of the next modification of the page on relevant date, so
12 that the page will be rebuilt if the condition changes.
16 The list of functions is given by the following regexp:
18 [ct](date|time)_(lt|gt|leq|geq|eq|neq)_(abs|page|now|today)(|_delta)
22 * `[ct]`: compare creation or modification time or date:
24 * `m`odification time.
25 * `(date|time)`: compare full date and time, or only date (useful when time is irrelevant):
26 * `time`: compare full date and time;
27 * `date`: compare only date.
28 * `(lt|gt|leq|geq|eq|neq)`: operator of comparison:
31 * `leq`: less or equal than;
32 * `geq`: greater or equal than;
35 * `(abs|page|now|today)`: element to compare to:
36 * `abs`: absolute date or time (given in argument);
37 * `page`: other page (given in argument);
38 * `now`: date or time of compilation;
39 * `today`: same meaning as `now`.
40 * `(|_delta)`: used to add a time delta (to use comparisons such as *created at least two days after `some_page`*):
42 * `_delta`: delta (given in argument).
44 ### Number of arguments
46 [[!table header=no data="""
47 | `now` `today` | `page` | `abs`
48 no delta | *no arguments* | `pagename` | `date`
49 delta | `delta` | `pagename, delta` | `date, delta`
52 ### Format of arguments
54 * *date* or *time*: anything that can be recognized by perl [[str2time|http://search.cpan.org/~rse/lcwa-1.0.0/lib/lwp/lib/HTTP/Date.pm]] function, *without any comma*.
55 * *delta*: One of the following patterns:
56 * `Y-M-D`: positive date;
57 * `H:M:S`: positive time;
58 * `Y-M-D H:M:S`: positive date and time;
59 * Add `-` at the beginning of the string to make durations negative.
60 * several arguments: when two arguments are provided, they are passed as one string, which is then split according to the last comma.
64 Key `timezone` in the setup file is used to define time zone. If not set, we
65 try to guess the local time zone.
71 * `ctime_gt_page(foo)`: match pages created after page `foo`.
72 * `cdate_eq_today()`: match pages created the day the wiki is compiled.
73 * `mtime_eq_now()`: match pages modified the time the wiki is compiled (likely no page, since comparison is done up to the milisecond).
74 * `cdate_geq_page_delta(foo, 00-00-01)`: match pages created at least one day after page `foo`.
75 * `cdate_gt_page(foo)`: same as the previous one.
76 * `mdate_gt_today_delta(-00-01-00)`: match pages modified one month ago, or later (can be used to display recent changes).
80 It can be used to display a list of upcoming events.
82 \[[!inline pages="events/* and cdate_geq_today()" reverse=yes sorted=meta(date)]]
86 Code and documentation this way: [[https://atelier.gresille.org/projects/gresille-ikiwiki/wiki/datetime_cmp]].