0

How would I create an exposed filter by season (spring, summer, fall, winter) based on date fields? I figured the approach would be to create date range filter groups by MONTH only (no year), but I don't see a straightforward way of doing this.

Any tips or advice for getting a workable solution? Thanks!

0

You can create the season date ranges and name them by using the Grouping Exposed filter option.

You can find it in the regular Date filter, select Grouped filters instead of Single filter for the Filter type to expose option.

Set the operators to Is between and enter the dates for your seasons (you can see spring and summer in this screnshot):

Views Date Grouped Exposed Filter

Drupal will assume midnight if you ommit the time and only include the date. You can look up the exact astronomical times for the seasons if you like :)

Be careful not to exclude some results if you use the same date in separate grouped options but not the same time.

2
  • Thanks @prkos for the answer... but I'm looking to get the month range WITHOUT THE YEAR. Your example still includes the year 2021, so only Spring/Summer in 2021 will show. Do you have a possible solution for accomplishing this month range for any year? – Yuckle Mar 17 at 23:45
  • Ah I misunderstood. There are Contextual filters for creating monthly Summary results. I think you need a custom solution that would create a Contextual filter for the seasons, similar to how the month+year Contextual filter works. – prkos Mar 18 at 14:40

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.