Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

fix(comments): don't show negative time stamps (#13898)

Nimar0a523abf5160
diff --git a/web/src/utils/dates.ts b/web/src/utils/dates.ts
index bbc9f95a5e..ec113ee8ca 100644
--- a/web/src/utils/dates.ts
+++ b/web/src/utils/dates.ts
@@ -60,7 +60,7 @@ export const getTimezoneDetails = () => {
};
export const getRelativeTimestampFromNow = (timestamp: Date): string => {
- const diffInMs = new Date().getTime() - timestamp.getTime();
+ const diffInMs = Math.max(0, new Date().getTime() - timestamp.getTime());
const diffInMinutes = diffInMs / (1000 * 60);
const diffInHours = diffInMinutes / 60;
const diffInDays = diffInHours / 24;