Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

change timeAgo heuristic to match the way Twitter displays timestamps

Steven Tey10cc85a474c9
diff --git a/lib/utils.ts b/lib/utils.ts
index 836c7bd6d0..a008d2b365 100644
--- a/lib/utils.ts
+++ b/lib/utils.ts
@@ -144,8 +144,8 @@ export const timeAgo = (timestamp?: Date): string => {
if (diff < 60000) {
// less than 1 second
return "Just now";
- } else if (diff > 604800000) {
- // more than 7 days
+ } else if (diff > 82800000) {
+ // more than 23 hours – similar to how Twitter displays timestamps
return new Date(timestamp).toLocaleDateString("en-US", {
month: "short",
day: "numeric",