diff --git a/app/src/main/java/com/keylesspalace/tusky/util/TimestampUtils.java b/app/src/main/java/com/keylesspalace/tusky/util/TimestampUtils.java
index c94b4229..5b911fb1 100644
--- a/app/src/main/java/com/keylesspalace/tusky/util/TimestampUtils.java
+++ b/app/src/main/java/com/keylesspalace/tusky/util/TimestampUtils.java
@@ -34,7 +34,10 @@ public class TimestampUtils {
public static String getRelativeTimeSpanString(Context context, long then, long now) {
long span = now - then;
boolean future = false;
- if (span < 0) {
+ if (Math.abs(span) < SECOND_IN_MILLIS) {
+ return context.getString(R.string.status_created_at_now);
+ }
+ else if (span < 0) {
future = true;
span = -span;
}
diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml
index 71ae7e18..e59d11f8 100644
--- a/app/src/main/res/values-de/strings.xml
+++ b/app/src/main/res/values-de/strings.xml
@@ -543,6 +543,7 @@
Melde alle Konten neu an, um die Unterstützung für Push-Benachrichtigungen zu aktivieren.
%1$s beigetreten
1+
+ Jetzt
Fehler beim Laden der Kontodetails
Bild bearbeiten
Details
diff --git a/app/src/main/res/values-es/strings.xml b/app/src/main/res/values-es/strings.xml
index ddc4f9d9..6e93c99f 100644
--- a/app/src/main/res/values-es/strings.xml
+++ b/app/src/main/res/values-es/strings.xml
@@ -231,6 +231,7 @@
Video
Solicitud enviada
+ Ahora
en %dy
en %dd
en %dh
diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml
index dd79b2f7..e1efb208 100644
--- a/app/src/main/res/values-ja/strings.xml
+++ b/app/src/main/res/values-ja/strings.xml
@@ -232,6 +232,7 @@
動画
フォローリクエスト中
+ 現在
%d年後
%d日後
%d時間後
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index fa55526d..2e82729c 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -360,6 +360,7 @@
Audio
Attachments
1+
+ now
Follow requested
diff --git a/app/src/test/java/com/keylesspalace/tusky/util/TimestampUtilsTest.kt b/app/src/test/java/com/keylesspalace/tusky/util/TimestampUtilsTest.kt
new file mode 100644
index 00000000..ded3b219
--- /dev/null
+++ b/app/src/test/java/com/keylesspalace/tusky/util/TimestampUtilsTest.kt
@@ -0,0 +1,29 @@
+package com.keylesspalace.tusky.util
+
+import android.content.Context
+import androidx.test.ext.junit.runners.AndroidJUnit4
+import com.keylesspalace.tusky.R
+import org.junit.Assert.assertEquals
+import org.junit.Test
+import org.junit.runner.RunWith
+import org.mockito.kotlin.doReturn
+import org.mockito.kotlin.mock
+import org.robolectric.annotation.Config
+
+private const val STATUS_CREATED_AT_NOW = "test"
+
+@Config(sdk = [28])
+@RunWith(AndroidJUnit4::class)
+class TimestampUtilsTest {
+ private val ctx: Context = mock {
+ on { getString(R.string.status_created_at_now) } doReturn STATUS_CREATED_AT_NOW
+ }
+
+ @Test
+ fun shouldShowNowForSmallTimeSpans() {
+ assertEquals(STATUS_CREATED_AT_NOW, TimestampUtils.getRelativeTimeSpanString(ctx, 0, 300))
+ assertEquals(STATUS_CREATED_AT_NOW, TimestampUtils.getRelativeTimeSpanString(ctx, 300, 0))
+ assertEquals(STATUS_CREATED_AT_NOW, TimestampUtils.getRelativeTimeSpanString(ctx, 501, 0))
+ assertEquals(STATUS_CREATED_AT_NOW, TimestampUtils.getRelativeTimeSpanString(ctx, 0, 999))
+ }
+}