diff --git a/core/lib/Drupal/Core/Datetime/DateFormatter.php b/core/lib/Drupal/Core/Datetime/DateFormatter.php index 34fcfa0..c2068cb 100644 --- a/core/lib/Drupal/Core/Datetime/DateFormatter.php +++ b/core/lib/Drupal/Core/Datetime/DateFormatter.php @@ -388,15 +388,7 @@ public function formatDiff($from, $to, $options = array()) { $granularity--; } - // If months already were found and there are no weeks, explicitly - // break out of both the switch and the foreach loop to ensure only - // adjacent parts are added to the output. This avoids getting - // output like "1 month 1 day". - if($parts > 0 && $weeks == 0) { - break 2; - } - - if ($granularity > 0 && $days > 0) { + if (($parts == 0 || $weeks > 0) && $granularity > 0 && $days > 0) { $interval_output .= ($interval_output ? ' ' : '') . $this->formatPlural($days, '1 day', '@count days', array(), array('langcode' => $options['langcode'])); } break; @@ -414,7 +406,7 @@ public function formatDiff($from, $to, $options = array()) { break; } - $output .= ($output ? ' ' : '') . $interval_output; + $output .= ($output && $interval_output ? ' ' : '') . $interval_output; $granularity--; $parts++; }