diff --git a/core/lib/Drupal/Core/Datetime/DateFormatter.php b/core/lib/Drupal/Core/Datetime/DateFormatter.php index d784743cd54..e7ded8c538a 100644 --- a/core/lib/Drupal/Core/Datetime/DateFormatter.php +++ b/core/lib/Drupal/Core/Datetime/DateFormatter.php @@ -146,6 +146,9 @@ public function format($timestamp, $type = 'medium', $format = '', $timezone = N * {@inheritdoc} */ public function formatInterval($interval, $granularity = 2, $langcode = NULL) { + if (!is_int($interval)) { + throw new \RuntimeException('$interval is not a string. It is a: ' . gettype($interval)); + } $output = ''; foreach ($this->units as $key => $value) { $key = explode('|', $key);