<target name="buildManager" depends="compile" description="Builds the stand-alone Gitblit Manager">\r
<echo>Building Gitblit Manager ${gb.version}</echo>\r
\r
- <genjar jarfile="maanager-${gb.version}.jar">\r
+ <genjar jarfile="manager-${gb.version}.jar">\r
<resource file="${basedir}/src/com/gitblit/client/splash.png" />\r
<resource file="${basedir}/resources/gitblt-favicon.png" />\r
<resource file="${basedir}/resources/gitweb-favicon.png" />\r
* Return the difference in days between now and the date.\r
* \r
* @param date\r
- * @param roundup\r
* @return days ago\r
*/\r
- public static int daysAgo(Date date, boolean roundup) {\r
- long diff = System.currentTimeMillis() - date.getTime();\r
+ public static int daysAgo(Date date) {\r
+ long today = ONEDAY * (System.currentTimeMillis()/ONEDAY);\r
+ long day = ONEDAY * (date.getTime()/ONEDAY);\r
+ long diff = today - day;\r
int days = (int) (diff / ONEDAY);\r
- if (roundup && (diff % ONEDAY) > 0) {\r
- days++;\r
- }\r
return days;\r
}\r
\r
if (css) {\r
return "age2";\r
}\r
- int days = daysAgo(date, true);\r
+ int days = daysAgo(date);\r
if (days < 365) {\r
if (days <= 30) {\r
return days + " days ago";\r
dateString = df.format(date);\r
}\r
String title = null;\r
- if (date.getTime() <= System.currentTimeMillis()) {\r
+ if (TimeUtils.isToday(date)) {\r
+ title = "today";\r
+ } else if (TimeUtils.isYesterday(date)) {\r
+ title = "yesterday";\r
+ } else if (date.getTime() <= System.currentTimeMillis()) {\r
// past\r
title = TimeUtils.timeAgo(date);\r
}\r
}\r
\r
public void testBasicTimeFunctions() throws Exception {\r
- assertTrue(TimeUtils.minutesAgo(offset(2 * TimeUtils.MIN), false) == 2);\r
- assertTrue(TimeUtils.minutesAgo(offset((2 * TimeUtils.MIN) + (35 * 1000L)), true) == 3);\r
+ assertEquals(2, TimeUtils.minutesAgo(offset(2 * TimeUtils.MIN), false));\r
+ assertEquals(3, TimeUtils.minutesAgo(offset((2 * TimeUtils.MIN) + (35 * 1000L)), true));\r
\r
- assertTrue(TimeUtils.hoursAgo(offset(2 * TimeUtils.ONEHOUR), false) == 2);\r
- assertTrue(TimeUtils.hoursAgo(offset(5 * TimeUtils.HALFHOUR), true) == 3);\r
+ assertEquals(2, TimeUtils.hoursAgo(offset(2 * TimeUtils.ONEHOUR), false));\r
+ assertEquals(3, TimeUtils.hoursAgo(offset(5 * TimeUtils.HALFHOUR), true));\r
\r
- assertTrue(TimeUtils.daysAgo(offset(4 * TimeUtils.ONEDAY), false) == 4);\r
- assertTrue(TimeUtils.daysAgo(offset(4 * TimeUtils.ONEDAY + 12 * TimeUtils.ONEHOUR), true) == 5);\r
+ assertEquals(4, TimeUtils.daysAgo(offset(4 * TimeUtils.ONEDAY)));\r
}\r
\r
public void testToday() throws Exception {\r