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