There are a few situations that some people need to filter nodes by a date-field on their repeat in a month or week. For example I have a content type of Event and it has a date-field (with optional end-date) and want to create a "view" to show todays event's.

I've searched a lot and tried lots of modules (such as partial_date, calendar, timefield, ...) but i couldnt come up with a good clean solution to my problem; dealing with yearly, monthly and weekly events using a Date field.

So I thought that it might be good approach to change type of "Filter granularity" (on filter extra settings for Date field types in Views) to checkboxes.

I've created a patch on date\date_api\date_api_sql.inc and would be thankful if you guys review and improve it since I'm new to drupal.

Change filter granularity from radios to checkboxes

So its possible to query only on month and day component of a date-field (yearly events such as birthdays):

A Yearly event filter sample

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

vijaycs85’s picture

Issue summary: View changes
Issue tags: +sprint
wwedding’s picture

Status: Needs review » Needs work

I haven't had an opportunity to see how well it works yet but there are some style issues. Otherwise I like what I'm seeing!

  • Indents should be 2 spaces and not tab characters.
  • There are some lines that have trailing whitespace chaarcters.
  • Empty lines should be empty (there's a tab character in one)
  • Control statements like if/switch need a space before the starting parenthesis (also refer to the guidelines for else statements)

You can refer to: https://drupal.org/coding-standards

I also like to run my code through the Coder module since I forget guidelines all the time.