From d8ab7d13ae18dfe37c86ad1a2e75d55bf7c52460 Mon Sep 17 00:00:00 2001 From: Haralan Dobrev Date: Thu, 30 Jan 2014 11:50:32 +0200 Subject: [PATCH] Show exact time in timestamp title attribute It is useful to have the exact time especially for recent events when the text is like 1 day ago. --- classes/Kohana/Tart/Column.php | 4 ++-- tests/tests/columnTest.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/classes/Kohana/Tart/Column.php b/classes/Kohana/Tart/Column.php index f956152..6af1c9e 100644 --- a/classes/Kohana/Tart/Column.php +++ b/classes/Kohana/Tart/Column.php @@ -148,7 +148,7 @@ protected static function render_field(Jam_Model $item, Jam_Field $field) return '-'; $time = is_numeric($value) ? $value : strtotime($value); - return ''.Tart_Html::date_span($time).''; + return ''.Tart_Html::date_span($time).''; } elseif ($field instanceof Jam_Field_Weblink) { @@ -167,4 +167,4 @@ protected static function render_field(Jam_Model $item, Jam_Field $field) return HTML::chars($value); } } -} \ No newline at end of file +} diff --git a/tests/tests/columnTest.php b/tests/tests/columnTest.php index 71a592c..024a325 100644 --- a/tests/tests/columnTest.php +++ b/tests/tests/columnTest.php @@ -74,7 +74,7 @@ public function test_default_fields() $rendered = $column->name('created_at')->render(); $year_diff = ( (int) date('Y')) - ( (int) date('Y', $this->city->created_at)); - $this->assertEquals(''.$year_diff.' years ago', $rendered); + $this->assertEquals(''.$year_diff.' years ago', $rendered); $rendered = $column->name('url')->render(); $this->assertEquals('http://example.com/ths-is-a-ve… ', $rendered);