public function DateIntervalData::getCastedValue in Duration Field 8.2
Same name and namespace in other branches
- 3.0.x src/Plugin/DataType/DateIntervalData.php \Drupal\duration_field\Plugin\DataType\DateIntervalData::getCastedValue()
Gets the primitive data value casted to the correct PHP type.
Return value
mixed
Overrides PrimitiveInterface::getCastedValue
File
- src/
Plugin/ DataType/ DateIntervalData.php, line 41
Class
- DateIntervalData
- Provides the Date Interval data type.
Namespace
Drupal\duration_field\Plugin\DataTypeCode
public function getCastedValue() {
// The casted value will be a PHP DateInterval object. The value of the
// object is an ISO 8601 Duration string, used to create the
// DateInterval object.
return new DateInterval($this
->getString());
}