# HG changeset patch # User Vincent Tondellier # Date 1455490584 -3600 # Node ID b75005d8b002064427a7985bbc51b2450ceb13b6 # Parent 95f4e3c47dd410c4953c2d2bee905fb129bec520 Display dates in human format diff -r 95f4e3c47dd4 -r b75005d8b002 lib/CrashTest/Helper/DateTime.pm --- a/lib/CrashTest/Helper/DateTime.pm Sun Feb 14 23:47:24 2016 +0100 +++ b/lib/CrashTest/Helper/DateTime.pm Sun Feb 14 23:56:24 2016 +0100 @@ -30,6 +30,18 @@ return "" unless $d; $d->strftime("%FT%TZ"); }); + + $app->helper(human_date_from_epoch => sub { + my ($c, $ts) = @_; + my $d; + eval { + $d = DateTime->from_epoch(epoch => $ts); + }; + $c->app->log->warn($@) if $@; + return "" unless $d; + $d->set_time_zone('local')->strftime("%F %T"); + }); + } sub _date_from_db_utc { diff -r 95f4e3c47dd4 -r b75005d8b002 templates/report/client_info.html.ep --- a/templates/report/client_info.html.ep Sun Feb 14 23:47:24 2016 +0100 +++ b/templates/report/client_info.html.ep Sun Feb 14 23:56:24 2016 +0100 @@ -1,10 +1,10 @@ %= t td => 'Start Time' - %= t td => $client_info->{StartupTime} + %= t td => human_date_from_epoch($client_info->{StartupTime}) %= t td => 'Crash Time' - %= t td => $client_info->{CrashTime} + %= t td => human_date_from_epoch($client_info->{CrashTime}) %= t td => 'Product' diff -r 95f4e3c47dd4 -r b75005d8b002 templates/report/crash.html.ep --- a/templates/report/crash.html.ep Sun Feb 14 23:47:24 2016 +0100 +++ b/templates/report/crash.html.ep Sun Feb 14 23:56:24 2016 +0100 @@ -6,6 +6,8 @@ %= t h3 => (class => 'panel-title') => "Crash for $processed_data->{client_info}->{ProductName} $processed_data->{client_info}->{Version}" % end %= t div => (class => 'panel-body') => begin + %= "Crash Time: " . human_date_from_epoch($processed_data->{client_info}->{CrashTime}); +
%= link_to "In crash group \"" . $crash_group->{title} . "\"" => url_for('group', uuid => $crash_group->{uuid}) % end % end diff -r 95f4e3c47dd4 -r b75005d8b002 templates/reports/index.atom.ep --- a/templates/reports/index.atom.ep Sun Feb 14 23:47:24 2016 +0100 +++ b/templates/reports/index.atom.ep Sun Feb 14 23:56:24 2016 +0100 @@ -10,7 +10,7 @@ tag:crash,2014:uuid::<%= $crash->{uuid} =%> - <%= $crash->{p_name} =%> <%= $crash->{p_version} =%>: <%= $crash->{uuid} =%> + <%= $crash->{p_name} =%> <%= $crash->{p_version} =%>: <%= $crash->{uuid} =%> <%= date_with_tz_from_db_utc($crash->{crash_time}) =%> <%= date_with_tz_from_db_utc($crash->{crash_time}) =%>