From 35aab8c392ac6ad404bb0d902cca6b50480072da Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 27 May 2015 11:57:29 +0800 Subject: Bug 1158010: provide a standard and simple way to render relative dates, in perl and javascript --- extensions/BugModal/Extension.pm | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'extensions/BugModal/Extension.pm') diff --git a/extensions/BugModal/Extension.pm b/extensions/BugModal/Extension.pm index 0bc96e730..f09a53425 100644 --- a/extensions/BugModal/Extension.pm +++ b/extensions/BugModal/Extension.pm @@ -17,10 +17,9 @@ use Bugzilla::Extension::BugModal::MonkeyPatches; use Bugzilla::Extension::BugModal::Util qw(date_str_to_time); use Bugzilla::Constants; use Bugzilla::User::Setting; -use Bugzilla::Util qw(trick_taint datetime_from html_quote); +use Bugzilla::Util qw(trick_taint datetime_from html_quote time_ago); use List::MoreUtils qw(any); use Template::Stash; -use Time::Duration qw(ago); our $VERSION = '1'; @@ -55,7 +54,7 @@ sub template_after_create { my ($self, $args) = @_; my $context = $args->{template}->context; - # wrapper around Time::Duration::ago() + # wrapper around time_ago() $context->define_filter( time_duration => sub { my ($context) = @_; @@ -63,7 +62,7 @@ sub template_after_create { my ($timestamp) = @_; my $datetime = datetime_from($timestamp) // return $timestamp; - return ago(abs(time() - $datetime->epoch)); + return time_ago($datetime); }; }, 1 ); -- cgit v1.2.3-24-g4f1b