Date Range field for Craft CMS 3
What is says on the tin
This plugin requires Craft CMS 3.0.0 or later.
To install the plugin, follow these instructions.
Open your terminal and go to your Craft project:
cd /path/to/project composer require studioespresso/craft-date-range ./craft install/plugin date-range
The following options can be set on the field:
- Show a start time field
- Show an end time field
When the field is set to required, both start & end date (and if enabled time) will be required.
Default time values
Since a PHP
DateTime object also has a time value, wether you entered on or not (or wether you have to option enabled to show the fields or not), the plugin tries to be smart in which time values get saved.
When you enable either or both time fields, that value will off course be safed. For fields that don't have time options set,
00:00:00 will get saved.
When using the field in your template, you have access to both
end properties, as well as:
endproperty is past the current date & time.
startproperty is ahead the current date & time.
startproperty is past the current date & time and the
endproperty is ahead of the current date & time.
Brought to you by Studio Espresso