Skip to content

Commit 607a9e8

Browse files
David Reissgitster
authored andcommitted
Round-down years in "years+months" relative date view
Previously, a commit from 1 year and 7 months ago would display as "2 years, 7 months ago". Signed-off-by: David Reiss <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e72263a commit 607a9e8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

date.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ const char *show_date(unsigned long time, int tz, enum date_mode mode)
135135
}
136136
/* Give years and months for 5 years or so */
137137
if (diff < 1825) {
138-
unsigned long years = (diff + 183) / 365;
138+
unsigned long years = diff / 365;
139139
unsigned long months = (diff % 365 + 15) / 30;
140140
int n;
141141
n = snprintf(timebuf, sizeof(timebuf), "%lu year%s",

0 commit comments

Comments
 (0)