I have a view /widgets with a couple of optional contextual filters of type "Has taxonomy term converted to ID", so the url can look like this:

  • /widgets/blue
  • /widgets/big
  • /widgets/small/green

And so on.

But there should also be a "current" contextual filter on the date field defined as such:

enter image description here

Currently, we used exposed date filters as such:

enter image description here enter image description here enter image description here

But for "current" widgets, my urls look like this:


How to make:

  • /widgets/blue/small/current do a filtering like field_date_value<=today && field_date_value2>=today ?
  • /widgets/past do a filtering like field_date_value2<today
  • /widgets/future to field_date_value>today
  • Would help if you could describe your filter. What field type is it (that we can guess), what are default values & operators etc. What's your Drupal and Views major versions? "Today" is generally supported, but not for ranges. Well, I guess it is possible to make it ?from=today&to=today for range, but that'a about that. – Mołot May 17 '13 at 10:04
  • Thanks for your feedback. I'm trying to have start_date<=today && end_date>=today in this case. – jpic May 17 '13 at 10:13

Use Views Contextual Range Filter module

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

|improve this answer|||||

I decided to create 3 sub-pages with normal filters, /widgets/all /widgets/past /widgets/current and /widgets/future.

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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