I am trying to get a list of seasonal items that dynamically display items based on the current month. It also includes items from the prior month and future month.

I have created a content type for this type of item, with an integer checkbox list. The values are 1|January, 2|February, 3|March, etc. When creating/editing a seasonal item. I check the checkboxes for the month(s) that the item is used.

I have created a view for current items, but have yet to find a way to dynamically set the filter for the item month. At the beginning of each month, I have to remember to go into the view, and uncheck the checkbox from (now) two months ago, and check the checkbox for the future month to maintain that three-month spread.

How can I make this filter dynamically create a three-month list based on the current month?

1 Answer 1


You should not have used List as your field type, you need to use Date as your field type. Using the Date module and enable Date UI and Date Views.

Then in MORE SETTINGS AND VALUES, Date Entry, select Custom Format and put F Y

enter image description here

Now in Views for filter add your date filter, in my example my Date field is called kewl

enter image description here

then use is in between previous month and next month

enter image description here

  • Thanks. I've tried as you suggested, adding a field to the content type, and filtering it in the view, but now it returns 0 records. I have made the date field accept unlimited entries, as items may be in season for several months.
    – Rob Cole
    Commented Jun 5, 2016 at 0:02
  • @RobCole updated my answer, turns out that you need to use a year because the Date filter does not let us use 0000 as the year. So use 2016 as a dummy year for all your dates (assuming year does not matter for your dates, else use the real year).
    – No Sssweat
    Commented Jun 5, 2016 at 1:38
  • I have updated the view to use month and year, but still no data returned. The content type Data Entry Custom Input Format is still set to "F". Should this be changed to "F Y", or does this not matter?
    – Rob Cole
    Commented Jun 5, 2016 at 16:57
  • I don't think date is the way to go as OP does not really want a date but a month that will stay the same no matter the year. I will use a views hook that runs prior to query execution, wherein I get current date and translate to month integer and add as views argument. Commented Jun 5, 2016 at 16:59
  • @RobCole custom input needs to be F Y
    – No Sssweat
    Commented Jun 5, 2016 at 23:40

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.