summaryrefslogtreecommitdiffstats
path: root/src/test/java/com/gitblit/utils/TimeUtilsTest.java
Commit message (Collapse)AuthorAgeFilesLines
* TimeUtils: Change daysAgo to calculate difference in calendar daysFlorian Zschocke2021-10-241-0/+424
| | | | | | | | | | | | | 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.
* TimeUtils: Move unit test to same package as TimeUtils isFlorian Zschocke2021-10-231-0/+266
For some reason the `TimeUtilsTest` class is, like almost all tests, in the `com.gitblit.tests` package. But this way all methods in classes which we might predominately need for tests have to be public. So move the unit test class `TimeUtilsTest` to the same package as the class it is testing, i.e. `com.gitblit.utils.TimeUtils`. This way we ca set the new added methods which get the current time passed in to be at least not public.