From fd0c0a608a5de2b26c29d3c44a7929e5a3b2c042 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 18 May 2009 00:14:07 +0000 Subject: Updated kohana and modules/unit_test to upstream r4356 --- kohana/helpers/date.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'kohana/helpers/date.php') 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), ','); } -- cgit v1.2.3