Skip to content

Commit

Permalink
#7 Change "Default with Number of days to event" Date format to "in N…
Browse files Browse the repository at this point in the history
… days" and "N days ago" instead of (confusing) numbers without any words
  • Loading branch information
yvolk committed Mar 14, 2020
1 parent 0c6f6b3 commit 856ec0a
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ public CharSequence formatDate(DateTime date) {
return formatDateTime(date, DateUtils.FORMAT_ABBREV_ALL | DateUtils.FORMAT_SHOW_DATE |
DateUtils.FORMAT_SHOW_WEEKDAY);
case DEFAULT_DAYS:
return formatNumberOfDaysToEvent(context, 5, getNumberOfDaysToEvent(date)) + ", " +
formatDateTime(date, DateUtils.FORMAT_SHOW_DATE);
return formatDefaultWithNumberOfDaysToEvent(date);
case DEFAULT_YTT:
CharSequence str1 = formatNumberOfDaysToEventText(context, 3, getNumberOfDaysToEvent(date));
return (str1.length() == 0 ? "" : str1 + ", ") + formatDateTime(date, DateUtils.FORMAT_SHOW_DATE);
Expand All @@ -76,6 +75,12 @@ public CharSequence formatDate(DateTime date) {
}
}

private CharSequence formatDefaultWithNumberOfDaysToEvent(DateTime date) {
String dateStub = "dateStub";
return formatDateCustom(date, "BBB, '" + dateStub + "', BBBB")
.replace(dateStub, formatDateTime(date, DateUtils.FORMAT_SHOW_DATE));
}

private String formatDateTime(DateTime date, int flags) {
long millis = toJavaDate(date).getTime();
return DateUtils.formatDateRange(context,
Expand Down

0 comments on commit 856ec0a

Please sign in to comment.