From dd490f2ac945a5998c4682688058e39c2ab6a6bf Mon Sep 17 00:00:00 2001 From: Andreas Date: Sat, 2 Apr 2022 14:52:53 +0200 Subject: [PATCH] Fix DST issue (#6831) --- .../java/eu/kanade/tachiyomi/util/lang/DateExtensions.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/lang/DateExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/lang/DateExtensions.kt index 33bf15dfd2..33368e44a9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/lang/DateExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/lang/DateExtensions.kt @@ -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 @@ -126,7 +126,8 @@ private val Date.timeWithOffset: Long get() { return Calendar.getInstance().run { time = this@timeWithOffset - this@timeWithOffset.time + timeZone.rawOffset + val dstOffset = get(Calendar.DST_OFFSET) + this@timeWithOffset.time + timeZone.rawOffset + dstOffset } }