Skip to content

Commit 6edda6b

Browse files
authored
Merge pull request #778 from hackclub/add-dates-to-signpost
Add timestamps to signpost
2 parents 41ebb56 + 324538d commit 6edda6b

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

bun.lockb

636 Bytes
Binary file not shown.

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"framer-motion": "^11.5.6",
3030
"howler": "^2.2.4",
3131
"ioredis": "^5.4.1",
32+
"javascript-time-ago": "^2.5.11",
3233
"js-confetti": "^0.12.0",
3334
"js-cookie": "^3.0.5",
3435
"lucide-react": "^0.446.0",

src/app/harbor/signpost/feed-items.tsx

+8
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ import { SignpostFeedItem } from '@/app/utils/data'
44
import JaggedCardSmall from '@/components/jagged-card-small'
55
import Cookies from 'js-cookie'
66
import Markdown from 'react-markdown'
7+
import TimeAgo from 'javascript-time-ago'
8+
import en from 'javascript-time-ago/locale/en'
9+
10+
TimeAgo.addDefaultLocale(en)
11+
const timeAgo = new TimeAgo('en-US')
712

813
export default function FeedItems() {
914
const cookie = Cookies.get('signpost-feed')
@@ -26,6 +31,9 @@ export default function FeedItems() {
2631
{feedItems.map((item, idx) => {
2732
return (
2833
<JaggedCardSmall key={idx} bgColor={`#${item.backgroundColor}`}>
34+
<p className="text-sm text-muted">
35+
{timeAgo.format(new Date(item.createdTime))}
36+
</p>
2937
<p style={{ color: `#${item.textColor}` }}>
3038
<span className="text-xl">
3139
{item.title}

0 commit comments

Comments
 (0)