Add option for selection by month, e.g., thismonth

Mel55113 - May 10, 2008 - 21:35
Project:Views Date Range Filter
Version:5.x-1.7
Component:Code
Category:feature request
Priority:normal
Assigned:Unassigned
Status:active
Description

In conjunction with the Views Group-By Pack, I'd like to be able to filter nodes on month boundaries relative to the current date. For example, if showing "future" events I'd like them to be after the first of the current month so the actual nodes listed would correspond with the implied monthly grouping.

As a quick and dirty solution I added the following code at about line 285 in daterange.module:

case 'thismonth':
  $cmtmon = date("n", time());
  $value = mktime( 0, 0, 0, $cmtmon , 1); // 0H, 0M, 0S, (current month), Day 1, (current year)
  break;

This is in the middle of the _get_date_named_value function just following the code for "weekago".

Thanks, and thanks for this useful filter.

 
 

Drupal is a registered trademark of Dries Buytaert.