... | ... |
@@ -1062,7 +1062,10 @@ sub parse_commit_text { |
1062 | 1062 |
$commit{age} = $age; |
1063 | 1063 |
$commit{age_string} = $self->_age_string($age); |
1064 | 1064 |
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday) = gmtime($commit{committer_epoch}); |
1065 |
- $commit{age_string_date} = sprintf '%4i-%02u-%02i', 1900 + $year, $mon+1, $mday; |
|
1065 |
+ $commit{age_string_date} = sprintf '%4d-%02d-%02d', 1900 + $year, $mon + 1, $mday; |
|
1066 |
+ $commit{age_string_datetime} = sprintf '%4d-%02d-%02d %02d:%02d:%02d', |
|
1067 |
+ 1900 + $year, $mon + 1, $mday, $hour, $min, $sec; |
|
1068 |
+ |
|
1066 | 1069 |
return \%commit; |
1067 | 1070 |
} |
1068 | 1071 |
|
... | ... |
@@ -1285,25 +1288,25 @@ sub _age_string { |
1285 | 1288 |
my ($self, $age) = @_; |
1286 | 1289 |
my $age_str; |
1287 | 1290 |
|
1288 |
- if ($age > 60 * 60 * 24 * 365) { |
|
1291 |
+ if ($age >= 60 * 60 * 24 * 365) { |
|
1289 | 1292 |
$age_str = (int $age/60/60/24/365); |
1290 | 1293 |
$age_str .= ' years ago'; |
1291 |
- } elsif ($age > 60*60*24*(365/12)) { |
|
1294 |
+ } elsif ($age >= 60 * 60 * 24 * (365/12)) { |
|
1292 | 1295 |
$age_str = int $age/60/60/24/(365/12); |
1293 | 1296 |
$age_str .= ' months ago'; |
1294 |
- } elsif ($age > 60*60*24*7) { |
|
1297 |
+ } elsif ($age >= 60 * 60 * 24 * 7) { |
|
1295 | 1298 |
$age_str = int $age/60/60/24/7; |
1296 | 1299 |
$age_str .= ' weeks ago'; |
1297 |
- } elsif ($age > 60*60*24) { |
|
1300 |
+ } elsif ($age >= 60 * 60 * 24) { |
|
1298 | 1301 |
$age_str = int $age/60/60/24; |
1299 | 1302 |
$age_str .= ' days ago'; |
1300 |
- } elsif ($age > 60*60) { |
|
1301 |
- $age_str = int $age/60/60; |
|
1303 |
+ } elsif ($age >= 60 * 60) { |
|
1304 |
+ $age_str = int $age / 60 / 60; |
|
1302 | 1305 |
$age_str .= ' hours ago'; |
1303 |
- } elsif ($age > 60) { |
|
1306 |
+ } elsif ($age >= 60) { |
|
1304 | 1307 |
$age_str = int $age/60; |
1305 | 1308 |
$age_str .= ' min ago'; |
1306 |
- } elsif ($age > 1) { |
|
1309 |
+ } elsif ($age >= 1) { |
|
1307 | 1310 |
$age_str = int $age; |
1308 | 1311 |
$age_str .= ' sec ago'; |
1309 | 1312 |
} else { |
... | ... |
@@ -13,7 +13,7 @@ |
13 | 13 |
<div class="span8"> |
14 | 14 |
<a style="color:#333" href="#" title="<%= $commit->{author_email} %>"><%= $commit->{author_name} %></a> |
15 | 15 |
<span class="muted"> |
16 |
- authored <%= $commit->{author_date} %> |
|
16 |
+ authored <span title="<%= $commit->{age_string_datetime} %>"><%= $commit->{age_string} %></span> |
|
17 | 17 |
</span> |
18 | 18 |
</div> |
19 | 19 |
<div class="text-right"> |
... | ... |
@@ -49,7 +49,7 @@ |
49 | 49 |
% } |
50 | 50 |
</div> |
51 | 51 |
<div class="span2" style="width:100px"> |
52 |
- <%= $commit->{age_string} %> |
|
52 |
+ <span title="<%= $commit->{age_string_datetime} %>"><%= $commit->{age_string} %></span> |
|
53 | 53 |
</div> |
54 | 54 |
<div class="span6" style="width:610px"> |
55 | 55 |
<a class="font-black" href="<%= url_for("/$user/$project/commit/$commit->{id}") %>"> |
... | ... |
@@ -56,6 +56,9 @@ note 'Project page'; |
56 | 56 |
# Description |
57 | 57 |
$t->content_like(qr/gitprep test repository/); |
58 | 58 |
|
59 |
+ # Commit datetime |
|
60 |
+ $t->content_like(qr/\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}/); |
|
61 |
+ |
|
59 | 62 |
# README |
60 | 63 |
$t->content_like(qr/README/); |
61 | 64 |
|