Contextual filter for month

Created on 4 November 2019, over 5 years ago
Updated 11 January 2025, 6 months ago

I really like the UI of Smart Date. I am creating an events calendar that is text based. To do this, I would like to be able to contextual filter that is for year and month (yyyy-mm). The only one I can currently find only allows for year, month, and day (yyyy-mm-dd). For core date fields, there is a patch to allow selecting granularity ( https://www.drupal.org/files/issues/2786577-270_0.patch β†’ ), but this doesn't seem to apply to Smart Date fields. Am I missing something?

Many thanks for any assistance you can provide.

✨ Feature request
Status

Active

Version

1.1

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States masande

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States j_s

    I'm also wondering this but for making a contextual filter for just Year. I want a URL like /myview/2020 where 2020 goes into a Smart Date-based contextual filter and shows results just for 2020. Is this possible yet?

  • πŸ‡¨πŸ‡¦Canada mandclu

    You should be able to accomplish the same thing without custom code by using the granularity options that Smart Date provides.

  • πŸ‡ΊπŸ‡ΈUnited States j_s

    From what I can see in a Smart Date contextual filter, there are no granularity options. Note that contextual filters are different from regular filters which do have granularity options.

  • πŸ‡ΊπŸ‡ΈUnited States mweixel

    I too see a need for adding granularity to contextual filters based on Smart Date fields. The addition to the stock filters was incredibly handy, but there are many scenarios where calling the view and supplying a date in the URL is the most straightforward method. Without being able to set granularity, it's impossible to do this.

    Is it really that difficult to adapt the granularity from the main filters for use with contextual filters?

Production build 0.71.5 2024