gitblit-org / gitblit

pure java git solution
http://gitblit.com
Apache License 2.0
2.27k stars 671 forks source link

Fix incorrect display of "days ago" on activity page #1382

Closed flaix closed 2 years ago

flaix commented 2 years ago

The timeAgo does not work correctly when in GMT time zone because of how the daysAgo method in TimeUtils works. This PR fixes that by changing to checking for actual full calendar days. To cover this with unit tests (as date issues are rather tricky), the methods in TimeUtils need to be overridden to make them testable in a reproducible way. And not have the test result dependent on the time of day the test is executed. This fixes issued #800 and #1248.