Commit b31ef5fa authored by kroky6's avatar kroky6

[ENH] range filter from/to/gap parameters can now contain relative time...

[ENH] range filter from/to/gap parameters can now contain relative time strings as 30 days and 1 hour
parent d66aa67c
......@@ -179,11 +179,14 @@ class Search_Query_WikiBuilder
function wpquery_filter_range($query, $value, array $arguments)
{
if ($arguments['from'] == 'now') {
$arguments['from'] = TikiLib::lib('tiki')->now;
if( isset($arguments['from']) && !is_numeric($arguments['from']) ) {
$arguments['from'] = strtotime($arguments['from']);
}
if ($arguments['to'] == 'now') {
$arguments['to'] = TikiLib::lib('tiki')->now;
if( isset($arguments['to']) && !is_numeric($arguments['to']) ) {
$arguments['to'] = strtotime($arguments['to']);
}
if( isset($arguments['gap']) && !is_numeric($arguments['gap']) ) {
$arguments['gap'] = strtotime($arguments['gap']) - time();
}
if (! isset($arguments['from']) && isset($arguments['to'], $arguments['gap'])) {
$arguments['from'] = $arguments['to'] - $arguments['gap'];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment