SilverStripe TimeField is a module which consists of 3 form fields.
- HTML5DateField
- HTML5TimeField
- TimeDropdownField
HTML5 date and time fields overwrite the SilverStripe's default DateField and TimeField with field which HTML5 input types. TimeDropdownField generates a dropdown field with time and you can set the interval
User composer to install
composer require silverstripers/silverstripe-timefield dev-master
First, the new input type reduce our reliance on client-side and server-side-scripting for validating inputs and this field is easy to use rather than using text field to enter time. No need of any coding to get the HTML5DateField and HTML5TimeField overwritten in site wide. Just need to install the module.
Based on the HTML5 date and time input types, these are supported in:
- Chrome 33+
- Firefox 22+
- Opera 22+
- Safari 7+
Internet explorer doesn't support this.
add this in your config.yml. value should be in seconds.
HTML5TimeField:
interval: '900'
add this in the getCMSFields() of the Page/DataObject you want to display the field. That will add 600 seconds inteval (10 mins).
$fields->addFieldToTab('Root.TabName', TimeDropdownField('FieldName')->setInterval(600))