This project is not covered by Drupal’s security advisory policy.

About

Provide extra datetime range formatters
This module provide two extra formatters for the core daterange field.
**Dategroup formatter** to group start and end dates. Works very well with a date format 'F d, Y '
**Datediff formatter** to display the difference between start and end date. IMPORTANT: 1 YEAR = 365 DAYS, 1 MONTH = 30 DAYS. Or simply use the difference in days

Usage

Download and install the module as usual. No additional configuration is needed.
Go to the tab "Manage display" then you can select and configure the formatter for any daterange field you wish to use.

Styling results

**Raw result** return the simple arithmetic result without any formatting.
**Full formatted difference** return the difference using 'Output format for the difference'
**Start date +days** return the start date and the difference in days. Use 'Date and Time Formats' for the date output.
**Dates and difference** return start and end date and the formatted difference. Use 'Date and Time Formats' for the date output and 'Output format for the difference' for the difference.

Duration

Will add 1 day to the result. Eg. If start and end date are the same the difference will be 1 day. If start 15/03 and end 18/03 difference will be 4 days.

Separator, date from difference

Will be present if 'Dates and difference' style is selected, name says it all.

Output format for the difference

REGEX formatter for the output. Any combination of 'Y', 'M' and 'D' and the optional 'X' for the difference in days, DOUBLEQUOTED WITH THE OPTIONAL SEPARATOR. The string will be replaced by values.
eg: "Y, " "M, " "D" return '1 Year, 1 Month, 1 Day', "Y+ " "M" return '1 Year + 1 Month'.
Don't forget to hit the *Save* button to store your changes** otherwise they are lost.

Additional modules

There are no additional modules.

Credits

[sdstyles] for the Date Group formatter and the general idea for this module.

Project information

Releases