summaryrefslogtreecommitdiff
path: root/kohana/helpers/date.php
diff options
context:
space:
mode:
Diffstat (limited to 'kohana/helpers/date.php')
-rw-r--r--kohana/helpers/date.php8
1 files changed, 7 insertions, 1 deletions
diff --git a/kohana/helpers/date.php b/kohana/helpers/date.php
index b926e626..1a5bbacb 100644
--- a/kohana/helpers/date.php
+++ b/kohana/helpers/date.php
@@ -374,7 +374,7 @@ class date_Core {
$span = array();
foreach ($difference as $name => $amount)
{
- if ($name !== $last AND $amount === 0)
+ if ($amount === 0)
{
// Skip empty amounts
continue;
@@ -384,6 +384,12 @@ class date_Core {
$span[] = ($name === $last ? ' and ' : ', ').$amount.' '.($amount === 1 ? inflector::singular($name) : $name);
}
+ // If the difference is less than 60 seconds, remove the preceding and.
+ if (count($span) === 1)
+ {
+ $span[0] = ltrim($span[0], 'and ');
+ }
+
// Replace difference by making the span into a string
$difference = trim(implode('', $span), ',');
}