5

Drupal 7, Views and Date modules installed.

I have a view on a content type with a date field (timestamp, but I can change it if necessary)

When I use it in filter criteria, I have no problem to use criteria like Mydate greater than, less than, between, not between etc. But if I try to do the same thing using contextual filters I have only the "equal" criteria. I need to do this, so i can call the view from code passing arguments to it.

I found some pages about Drupal 6 where is written that i can pass parameter to the filter in format: 2008-11-12--2010-11-12, but when i try to make it and hit 'update preview', i obtain: (field_data_field_test_date.field_test_date_value = '2008-01-01--2010-12-31') in the query.

I need to:

  • use criteria greater than, less than, between
  • pass date range to the view

Does anybody have some suggestion on how I can do it?

2
  • @OwenBlacker We don't cross-post on sites in the SE network, that's considered noise. This is being migrated though, and you should recommend that in the future
    – casperOne
    May 23, 2012 at 13:04
  • @casperOne That makes complete sense. I'll bear that in mind in future. Thanks for the reminder. May 24, 2012 at 11:17

2 Answers 2

0

Please refer below URL and check the answer given by @Dmitriy

How to implement less than / greater than in views contextual filters

This may help you.

0

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

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.