Fix off by 1 dates (fixes #6791)
This commit is contained in:
parent
8e332dba30
commit
5c0a43e8d6
@ -66,7 +66,7 @@ class HistoryPresenter : BasePresenter<HistoryController>() {
|
||||
.map { recents ->
|
||||
val map = TreeMap<Date, MutableList<MangaChapterHistory>> { d1, d2 -> d2.compareTo(d1) }
|
||||
val byDay = recents
|
||||
.groupByTo(map, { it.history.last_read.toDateKey() })
|
||||
.groupByTo(map) { it.history.last_read.toDateKey() }
|
||||
byDay.flatMap { entry ->
|
||||
val dateItem = DateSectionItem(entry.key, relativeTime, dateFormat)
|
||||
entry.value.map { HistoryItem(it, dateItem) }
|
||||
|
@ -84,7 +84,7 @@ class UpdatesPresenter : BasePresenter<UpdatesController>() {
|
||||
.map { mangaChapters ->
|
||||
val map = TreeMap<Date, MutableList<MangaChapter>> { d1, d2 -> d2.compareTo(d1) }
|
||||
val byDay = mangaChapters
|
||||
.groupByTo(map, { it.chapter.date_fetch.toDateKey() })
|
||||
.groupByTo(map) { it.chapter.date_fetch.toDateKey() }
|
||||
byDay.flatMap { entry ->
|
||||
val dateItem = DateSectionItem(entry.key, relativeTime, dateFormat)
|
||||
entry.value
|
||||
|
@ -112,8 +112,8 @@ fun Date.toRelativeString(
|
||||
val days = difference.floorDiv(MILLISECONDS_IN_DAY).toInt()
|
||||
return when {
|
||||
difference < 0 -> context.getString(R.string.recently)
|
||||
difference < MILLISECONDS_IN_DAY -> context.getString(R.string.relative_time_today)
|
||||
difference < MILLISECONDS_IN_DAY.times(range) -> context.resources.getQuantityString(
|
||||
difference <= MILLISECONDS_IN_DAY -> context.getString(R.string.relative_time_today)
|
||||
difference <= MILLISECONDS_IN_DAY.times(range) -> context.resources.getQuantityString(
|
||||
R.plurals.relative_time,
|
||||
days,
|
||||
days
|
||||
|
Loading…
Reference in New Issue
Block a user