From 0ae52e91ceaf1af41f12bfa6e76c7d719be5e0e5 Mon Sep 17 00:00:00 2001
From: Eric Bailey <git@esb.lol>
Date: Wed, 19 Jul 2023 12:16:57 -0500
Subject: #984 Updating `indexedAt` timestamps (#1024)

* add TimeElapsed util component, integrate into PostThreadItem

* integrate into posts

* use consistent naming

* use mobx and single interval for TimeElapsed
---
 src/view/com/post-thread/PostThreadItem.tsx | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

(limited to 'src/view/com/post-thread/PostThreadItem.tsx')

diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx
index 133d38421..efc9fe694 100644
--- a/src/view/com/post-thread/PostThreadItem.tsx
+++ b/src/view/com/post-thread/PostThreadItem.tsx
@@ -15,7 +15,7 @@ import {PostDropdownBtn} from '../util/forms/DropdownButton'
 import * as Toast from '../util/Toast'
 import {PreviewableUserAvatar} from '../util/UserAvatar'
 import {s} from 'lib/styles'
-import {ago, niceDate} from 'lib/strings/time'
+import {niceDate} from 'lib/strings/time'
 import {sanitizeDisplayName} from 'lib/strings/display-names'
 import {pluralize} from 'lib/strings/helpers'
 import {getTranslatorLink, isPostInLanguage} from '../../../locale/helpers'
@@ -30,6 +30,7 @@ import {PostSandboxWarning} from '../util/PostSandboxWarning'
 import {ErrorMessage} from '../util/error/ErrorMessage'
 import {usePalette} from 'lib/hooks/usePalette'
 import {formatCount} from '../util/numeric/format'
+import {TimeElapsed} from 'view/com/util/TimeElapsed'
 
 const PARENT_REPLY_LINE_LENGTH = 8
 
@@ -189,7 +190,10 @@ export const PostThreadItem = observer(function PostThreadItem({
                   </Text>
                 </Link>
                 <Text type="md" style={[styles.metaItem, pal.textLight]}>
-                  &middot; {ago(item.post.indexedAt)}
+                  &middot;&nbsp;
+                  <TimeElapsed timestamp={item.post.indexedAt}>
+                    {({timeElapsed}) => <>{timeElapsed}</>}
+                  </TimeElapsed>
                 </Text>
               </View>
               <View style={s.flex1} />
-- 
cgit 1.4.1

