Views Date Range Filter

The daterange module provides a programatic extension for date ranges that can be used by other module developers. It creates new filters for node times, 'Node: Created Time Between' and 'Node: Changed Time Between', as well as new date range filters for CCK date (but not datestamp) fields.

If jscalendar is installed and enabled the date fields are augmented with the jscalendar button for selecting a date.

The supported operators are 'Custom date range', 'Outside date range', 'Before', 'After', 'within the past week', 'within the past month',
'within the past 3 months', 'within the past year'. When the the operator doesn't need both input fields, JavaScript attempts to undisplay the unused fields.

The date fields understand the words 'today' and 'yesterday' and sutraction of days, months, or years.

For example:

'today-1' is 'yesterday'
'today-7' is a week ago
'today-1M' is a month ago
'today-2Y' is two years ago

If you'd like additional operations or fewer operations, you can use the hook_form_filter to hook the form and change the options. Hint: make sure your custom modules weight is higher than this modules weight, so that your module runs after the daterange module.

Installation

  1. Install these files (daterange.module and daterange.js) in the modules directory of your choice (for example, sites/yoursite.com/modules/daterange or modules/daterange).
  2. Enable the daterange in the admin/modules page.
  3. Create a view and add the 'Node: Created Time Between' or 'Node: Changed Time Between'.

Todo

  1. add support for CCK datestamp's
  2. add default ranges for future dates
  3. add option the indicates if the default ranges should include past or future, (or both) ranges

This module is partially supported by CivicActions.

6
Average: 6 (1 vote)

The way you tried to explain

The way you tried to explain some of the posts here I think, different ...

CVS Commits

  • cvsuid: 
    29191
    cvstag: 
    DRUPAL-5
    cvscomment: 
    fix setting of past/future option
    cvscid: 
    119411

    commit #119411 by douggreen on DRUPAL-5 - fix setting of past/future option

  • cvsuid: 
    29191
    cvstag: 
    DRUPAL-6--1
    cvscomment: 
    clean up info file
    cvscid: 
    113208

    commit #113208 by douggreen on DRUPAL-6--1 - clean up info file

  • cvsuid: 
    29191
    cvstag: 
    DRUPAL-5
    cvscomment: 
    remove author attribution (see http://www.youtube.com/watch?v=ZSFDm3UYkeE)
    cvscid: 
    106166

    commit #106166 by douggreen on DRUPAL-5 - remove author attribution (see http://www.youtube.com/watch?v=ZSFDm3UYkeE)

  • cvsuid: 
    29191
    cvstag: 
    DRUPAL-5
    cvscomment: 
    code style - remove extra spaces
    cvscid: 
    104266

    commit #104266 by douggreen on DRUPAL-5 - code style - remove extra spaces

  • cvsuid: 
    29191
    cvstag: 
    DRUPAL-5
    cvscomment: 
    <a href="http://drupal.org/node/228194">#228194</a> - fix js for today+ values
    cvscid: 
    103739

    commit #103739 by douggreen on DRUPAL-5 - #228194 - fix js for today+ values