From a7dc5e05b3b5dff845b8c5cf32b3dc540e85e9ad Mon Sep 17 00:00:00 2001 From: Shariq Ansari Date: Tue, 1 Jul 2025 19:20:04 +0530 Subject: [PATCH] fix: show absolute day count not in decimels --- frontend/src/utils/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/frontend/src/utils/index.js b/frontend/src/utils/index.js index 375d5f51..44e18381 100644 --- a/frontend/src/utils/index.js +++ b/frontend/src/utils/index.js @@ -104,7 +104,7 @@ export function prettyDate(date, mini = false) { if (Math.abs(dayDiff) >= 1 && Math.abs(dayDiff) < 1.5) { return __('tomorrow') } else if (Math.abs(dayDiff) < 7) { - return __('in {0} d', [Math.abs(dayDiff)]) + return __('in {0} d', [Math.floor(Math.abs(dayDiff))]) } else if (Math.abs(dayDiff) < 31) { return __('in {0} w', [Math.floor(Math.abs(dayDiff) / 7)]) } else if (Math.abs(dayDiff) < 365) { @@ -121,6 +121,7 @@ export function prettyDate(date, mini = false) { return __('{0} h', [Math.floor(diff / 3600)]) } } else { + dayDiff = Math.floor(dayDiff) if (dayDiff < 7) { return __('{0} d', [dayDiff]) } else if (dayDiff < 31) { @@ -150,7 +151,7 @@ export function prettyDate(date, mini = false) { if (Math.abs(dayDiff) >= 1 && Math.abs(dayDiff) < 1.5) { return __('tomorrow') } else if (Math.abs(dayDiff) < 7) { - return __('in {0} days', [Math.abs(dayDiff)]) + return __('in {0} days', [Math.floor(Math.abs(dayDiff))]) } else if (Math.abs(dayDiff) < 31) { return __('in {0} weeks', [Math.floor(Math.abs(dayDiff) / 7)]) } else if (Math.abs(dayDiff) < 365) { @@ -173,6 +174,7 @@ export function prettyDate(date, mini = false) { return __('{0} hours ago', [Math.floor(diff / 3600)]) } } else { + dayDiff = Math.floor(dayDiff) if (dayDiff == 1) { return __('yesterday') } else if (dayDiff < 7) {