]> source.dussan.org Git - gitblit.git/commit
TimeUtils: Change daysAgo to calculate difference in calendar days 1382/head
authorFlorian Zschocke <f.zschocke+git@gmail.com>
Sat, 23 Oct 2021 22:44:18 +0000 (00:44 +0200)
committerFlorian Zschocke <f.zschocke+git@gmail.com>
Sat, 23 Oct 2021 22:44:18 +0000 (00:44 +0200)
commit920fc522b47b90c534848dc926af1bbc5f517592
treeacf5d2ddc5939311ba92beca4909fede35c2901b
parentbb15bf10a7052adf0f5feb55db4f894a9053adac
TimeUtils: Change daysAgo to calculate difference in calendar days

The `daysAgo` method seemed to want to normalize on a calendar day? I
can't really tell what it was trying to do, but the problem is that it
does not take into account any time shift due to time zones so it never
really worked outside of GMT.
So instead a new `calendarDaysAgo` method is added (because I am unsure
on what the `daysAgo` method is trying to do. It can probably be removed).
The new method cleanly calculates difference in calendar days because it
normalizes the two given time stamps on the same time zone.

The `timeAgo` method now used the new method. This fixes #1248.
src/main/java/com/gitblit/utils/TimeUtils.java
src/test/java/com/gitblit/utils/TimeUtilsTest.java