summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authordamoasda <46045854+damoasda@users.noreply.github.com>2019-07-08 21:14:56 +0200
committerGitHub <noreply@github.com>2019-07-08 21:14:56 +0200
commit63eb766dffe9684899f2d27e3dad540bc3c9f184 (patch)
treed25770d088726217d7a13dfcd012e9597c06cd5f /core/src
parent082a4521567265e3e54a9dfefa3041f3d7ffc29a (diff)
parent9e72780bc8ac8456076c8e47090e803286904601 (diff)
downloadAntennaPod-63eb766dffe9684899f2d27e3dad540bc3c9f184.zip
Merge pull request #1 from AntennaPod/develop
Update fork
Diffstat (limited to 'core/src')
-rw-r--r--core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java b/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java
index 5141e3a78..668f938a0 100644
--- a/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java
+++ b/core/src/main/java/de/danoeh/antennapod/core/util/DateUtils.java
@@ -7,6 +7,7 @@ import org.apache.commons.lang3.StringUtils;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
+import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.Locale;
@@ -162,11 +163,10 @@ public class DateUtils {
if (date == null) {
return "";
}
+ GregorianCalendar now = new GregorianCalendar();
GregorianCalendar cal = new GregorianCalendar();
- cal.add(GregorianCalendar.YEAR, -1);
- // some padding, because no one really remembers what day of the month it is
- cal.add(GregorianCalendar.DAY_OF_MONTH, 10);
- boolean withinLastYear = date.after(cal.getTime());
+ cal.setTime(date);
+ boolean withinLastYear = now.get(Calendar.YEAR) == cal.get(Calendar.YEAR);
int format = android.text.format.DateUtils.FORMAT_ABBREV_ALL;
if (withinLastYear) {
format |= android.text.format.DateUtils.FORMAT_NO_YEAR;