diff --git a/src/lib/strings/time.ts b/src/lib/strings/time.ts index 8357d3c3..6cd70498 100644 --- a/src/lib/strings/time.ts +++ b/src/lib/strings/time.ts @@ -27,3 +27,15 @@ export function ago(date: number | string | Date): string { return new Date(ts).toLocaleDateString() } } + +export function niceDate(date: number | string | Date) { + const d = new Date(date) + return `${d.toLocaleDateString('en-us', { + year: 'numeric', + month: 'short', + day: 'numeric', + })} at ${d.toLocaleTimeString(undefined, { + hour: 'numeric', + minute: '2-digit', + })}` +} diff --git a/src/lib/styles.ts b/src/lib/styles.ts index 1ff2d520..00a8638f 100644 --- a/src/lib/styles.ts +++ b/src/lib/styles.ts @@ -122,12 +122,15 @@ export const s = StyleSheet.create({ ml2: {marginLeft: 2}, ml5: {marginLeft: 5}, ml10: {marginLeft: 10}, + ml20: {marginLeft: 20}, mt2: {marginTop: 2}, mt5: {marginTop: 5}, mt10: {marginTop: 10}, + mt20: {marginTop: 20}, mb2: {marginBottom: 2}, mb5: {marginBottom: 5}, mb10: {marginBottom: 10}, + mb20: {marginBottom: 20}, // paddings p2: {padding: 2}, diff --git a/src/view/com/post-thread/PostThreadItem.tsx b/src/view/com/post-thread/PostThreadItem.tsx index 19115119..953e67b1 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 {UserAvatar} from '../util/UserAvatar' import {s} from 'lib/styles' -import {ago} from 'lib/strings/time' +import {ago, niceDate} from 'lib/strings/time' import {sanitizeDisplayName} from 'lib/strings/display-names' import {pluralize} from 'lib/strings/helpers' import {useStores} from 'state/index' @@ -235,7 +235,10 @@ export const PostThreadItem = observer(function PostThreadItem({ ) : undefined} - {item._isHighlightedPost && hasEngagement ? ( + + {niceDate(item.post.indexedAt)} + + {hasEngagement ? ( {item.post.repostCount ? (