Browse Source

Fix DST issue (#6831)

Andreas 3 years ago
parent
commit
dd490f2ac9
1 changed files with 4 additions and 3 deletions
  1. 4 3
      app/src/main/java/eu/kanade/tachiyomi/util/lang/DateExtensions.kt

+ 4 - 3
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
-            [email protected] + timeZone.rawOffset
+            val dstOffset = get(Calendar.DST_OFFSET)
+            [email protected] + timeZone.rawOffset + dstOffset
         }
     }