For Drupal 7, Views grouping and rewriting has been easy due to easy retrieval and controls of tokens. On D8, this gets tricky for the Date Views. If you have a set-up similar to this, the steps in the subsequent section might help:

Requirements: Events Listing page

  • Show generic events listing, for example by event title, date, description in a tabular display (used Bootstrap responsive table)
    Column groupings have no issue as default Views field order can be controlled in the table format settings
  • Further Group events by Month and Year - an example is to show a heading before the grouped event rows as "January 2020", under which are listed grouped nodes or event content items with dates under that month, and so on and so forth
    Tricky as the table or group settings does not provide any way to do this easily

Solutions/Workaround

Make use of another field custom-date formatted as Month + Year, hide this from the display, and use this for the grouping under the table format settings. Steps below: 

  1. Download and install https://www.drupal.org/project/date_group, we will need this later
  2. Create a View for the Events listing, will work either as Page or Block view
  3. Setup the format, fields to display as needed, e.g. Event Title, Date/s, Body, etc.
  4. Important to set format as a table, e.g. Bootstrap Table or any Table formats, necessary to have a nice columnar view
  5. Create another date field: Custom Date format for Month and Year only, to be used as format for the grouping later, hide this (do not display field), and set this field's display format to Date Group (this formatter provided by the additional module installed)
  6. Go back to Table settings, then group the hidden field. This will now group your content items accordingly

Screenshots of Steps

Drupal 8 views grouping items by date month and year

Drupal 8 views grouping items by date month and year

Drupal 8 views grouping items by date month and year

Display Output of Event calendar items grouped by Month and Year

Drupal 8 views grouping items by date month and year

Drupal 8 views grouping items by date month and year

 

Leave a Comment

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
To prevent automated spam submissions leave this field empty.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
4 + 1 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.
Get reliable web hosting services

Recurring donation

Make Donation

  • Other: $

Donate now

Single donation

Make Donation

  • Other: $

Donate now