Smart Date and Views

Last updated on
30 January 2023

This documentation needs review. See "Help improve this page" in the sidebar.

Smart Date exposes to views the ability to use multiple values for output, filters, or sorting, including:

  • The full range (formatted)
  • The start of the date/time range
  • The end of the date/time range
  • The duration (difference in minutes between the previous two)

An example of what this looks like in the Views interface:

screencapture of what smartdate looks like in views. "When, When - Duration, When - End, and When - Start" content options are displayed.

For output, unless you specifically need to out put the start and end values separately (for example, if displaying a table, or in a filter) it is recommend to use the first value listed (which will output the formatted range. Also note that using this field is required for both the start and end values when configuring the settings for a Fullcalendar View display as described in this issue. A screen capture of what this looks like in the display settings is below:

screencapture of the start date and end date fields

Also note that Smart Date saves expected values in both the start and end values even for zero duration ranges (the same time is stored for both) or for all day events (the start is saved as 12 a.m. and the end as 11:59 p.m.). The result is that when adding a filter you don't need to worry about special handling for these types of events, you can add a filter whose logic is equivalent to "end value is greater than now" and it should work properly for all kinds of events.

When formatting the output of a Smart Date field, you have the option to use an existing Smart Date format, or use the custom formatter to set values specifically for your view.

Compatible modules

Fullcalendar View

For Fullcalendar View versions in the 8.x-2.x branch, it is necessary to use the patch in this issue for Smart Date values to show. As of the 8.x-4.x/9.x-1.x branch, it should no longer be necessary to patch Fullcalendar View. For the 8.x-4.1 version it's recommend to use the patch in this issue if drag and drop resizing of events is desired.

One final note for using Smart Date with Fullcalendar View: If your field supports multiple values it will be necessary to deselect "show multiple results in the same row" in the field display configuration to get them to display properly.

Calendar View

Smart Date and recurring date fields has been tested extensively with the Calendar View and reported to be fully working. 

The only known limitation is for multi value recurring fields. You must render the View results as fields and you must leave the "Show all results in the same row" unchecked.

Read this guide for further information and a complete step-by-step tutorial.

Adding a Date Picker Exposed Filter

You can use a date picker for an exposed filter by installing and enabling the Better Exposed Filters module.

Help improve this page

Page status: Needs review

You can: