Granularity for Contextual Filters

Created on 17 August 2025, about 2 months ago

Problem/Motivation

I have been challenged in finding a way to provide granularity features for contextual filters based on Smart Date fields similar to what I could do with date/time fields in Drupal 7. While the granularity features added to traditional filter handler work very well, the lack of a way to effectively contextualize an argument passed to the view via a contextual filter pretty much stopped one of my projects dead in its tracks.

Steps to reproduce

  1. Create a view that includes a content type with a smart date field
  2. Add a contextual filter that targets the smart date field
  3. In the configuration for the contextual filter, there are no options to set the granularity for a date that is passed into the view as an argument. As a result, passing a Y-m-d formatted date like "2025-08-17" can't be interpreted to be part of "dates in 2025" or "dates in August".

Proposed resolution

The traditional filter's granularity options are defined in a handler. Update the argument handler to provide similar functionality in the contextual filters.

✨ Feature request
Status

Active

Version

4.2

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States mweixel

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

Comments & Activities

Production build 0.71.5 2024