Drupal 7.23, Views 7.x-3.7
I have a Calendar Event content type, with a date field.
In my view, I need to pass a date range as a contextual filter such that if the event's date falls within the specified range, the events is returned.
In other words, something like /events-calendar/2013-09-04/2013-09-30 should return any events happening for the rest of this month. So far I'm only able to match a single date, not a range.
Any ideas appreciated.

  • Could you provide your desired filtering as a pseudocode algorithm? I've seen quite too many ideas how such filtering should really work to dare to guess.
    – Mołot
    Commented Sep 4, 2013 at 9:21

2 Answers 2


Assuming that you have set up your contextual filters properly, all you need to do is change the format of the date you pass.


That above format should do the trick.

  • In case anyone's interested, I set up these links in a block, and the code looks like this: echo "<br/><a href=\"/events-calendar/"; echo date('Ymd', strToTime('first day of this month')); echo "--"; echo date('Ymd', strToTime('last day of this month')); echo "\">This Month</a>";
    – Sam Moore
    Commented Sep 4, 2013 at 15:19
  • Glad it helped :)
    – Gokul N K
    Commented Sep 5, 2013 at 6:24

If you are looking for ranges in general within the contextual filters then you should consider using the Views Contextual Range Filter module. Some more details about it:

Views Contextual Range Filter is a simple plugin for Views that adds the option to contextually filter not just by a single value, but also by range.

Numeric, alphabetical and list ranges are all supported. Node ids, user ids and even taxonomy term ids are all special cases of numbers so will work also. Range-filtering on dates is also supported. For this you may use either the absolute date format as dictated by Views, YYYYMMDD, or the relative format, which supports natural language phrases like six months ago, today noon and even first Tuesday of November.

Please be aware that contextual filters are different from exposed filters. This module is about contextual filters only.

You may use the OR operator (i.e. +) and the negate operator. You negate by ticking the "Exclude" box on the Views Contextual filter configuration panel, in the "More" section.

  • Adding this a separate answer this is not exactly what you asked for. But might help others who are looking for this.
    – Gokul N K
    Commented Sep 4, 2013 at 9:58
  • I will definitely check this out, as it looks as if it might prove useful elsewhere. Thanks for your input and your answer (sorry I don't have enough reputation points to vote up your answers - kinda new here :-)
    – Sam Moore
    Commented Sep 4, 2013 at 15:07
  • Except that project specifically says that for dates, using the Date module, you don't need the contextual_range_filter module... Commented Sep 26, 2013 at 21:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.