Showing 2 changed files with 12 additions and 12 deletions
+1 -1
lib/Gitprep/Git.pm
... ...
@@ -1575,7 +1575,7 @@ sub trees {
1575 1575
 sub _age_ago {
1576 1576
   my($self,$unit,$age) = @_;
1577 1577
 
1578
-  return $age . " $unit" . ( $unit =~ /^(sec|min)$/ ? "" : "s" ) . " ago";
1578
+  return $age . " $unit" . ( $unit =~ /^(sec|min)$/ ? "" : ( $age > 1 ? "s" : "" ) ) . " ago";
1579 1579
 }
1580 1580
 
1581 1581
 sub _age_string {
+11 -11
t/age_string.t
... ...
@@ -14,21 +14,21 @@ my @cases = (
14 14
   { stimulus =>                  2 * 60,     expected => '2 min ago'     },
15 15
   { stimulus =>                  2 * 60 + 1, expected => '2 min ago'     },
16 16
   { stimulus =>                 60 * 60 - 1, expected => '59 min ago'    },
17
-  { stimulus =>                 60 * 60,     expected => 'a hours ago'   },
18
-  { stimulus =>                 60 * 60 + 1, expected => 'a hours ago'   },
19
-  { stimulus =>                 61 * 60,     expected => 'a hours ago'   },
17
+  { stimulus =>                 60 * 60,     expected => 'a hour ago'    },
18
+  { stimulus =>                 60 * 60 + 1, expected => 'a hour ago'    },
19
+  { stimulus =>                 61 * 60,     expected => 'a hour ago'    },
20 20
   { stimulus =>            24 * 60 * 60 - 1, expected => '23 hours ago'  },
21
-  { stimulus =>            24 * 60 * 60,     expected => 'a days ago'    },
22
-  { stimulus =>            24 * 60 * 60 + 1, expected => 'a days ago'    },
21
+  { stimulus =>            24 * 60 * 60,     expected => 'a day ago'     },
22
+  { stimulus =>            24 * 60 * 60 + 1, expected => 'a day ago'     },
23 23
   { stimulus =>        7 * 24 * 60 * 60 - 1, expected => '6 days ago'    },
24
-  { stimulus =>        7 * 24 * 60 * 60,     expected => 'a weeks ago'   },
25
-  { stimulus =>        7 * 24 * 60 * 60 + 1, expected => 'a weeks ago'   },
24
+  { stimulus =>        7 * 24 * 60 * 60,     expected => 'a week ago'    },
25
+  { stimulus =>        7 * 24 * 60 * 60 + 1, expected => 'a week ago'    },
26 26
   { stimulus => (365/12) * 24 * 60 * 60 - 1, expected => '4 weeks ago'   },
27
-  { stimulus => (365/12) * 24 * 60 * 60,     expected => 'a months ago'  },
28
-  { stimulus => (365/12) * 24 * 60 * 60 + 1, expected => 'a months ago'  },
27
+  { stimulus => (365/12) * 24 * 60 * 60,     expected => 'a month ago'   },
28
+  { stimulus => (365/12) * 24 * 60 * 60 + 1, expected => 'a month ago'   },
29 29
   { stimulus =>  365     * 24 * 60 * 60 - 1, expected => '11 months ago' },
30
-  { stimulus =>  365     * 24 * 60 * 60,     expected => 'a years ago'   },
31
-  { stimulus =>  365     * 24 * 60 * 60 + 1, expected => 'a years ago'   },
30
+  { stimulus =>  365     * 24 * 60 * 60,     expected => 'a year ago'    },
31
+  { stimulus =>  365     * 24 * 60 * 60 + 1, expected => 'a year ago'    },
32 32
 );
33 33
 
34 34
 plan ( tests => scalar @cases );