about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMary <148872143+mary-ext@users.noreply.github.com>2024-02-24 03:38:14 +0700
committerGitHub <noreply@github.com>2024-02-23 12:38:14 -0800
commit4771caf2042eea52fd5f5c878c5e0b280634c0c6 (patch)
tree2e3b2b5c40d713afdaf015ad8d0f396ca276286a /src
parent1c5a2232fc854a52a5651ea75c07d090544bf2be (diff)
downloadvoidsky-4771caf2042eea52fd5f5c878c5e0b280634c0c6.tar.zst
Normalize relative day (#2874)
* fix: normalize relative date

* chore: add comments

* refactor: skip flooring normalized diff

* refactor: let -> const

* fix: get own copy of date to prevent mutating

* refactor: rounding does the same trick
Diffstat (limited to 'src')
-rw-r--r--src/lib/strings/time.ts2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/lib/strings/time.ts b/src/lib/strings/time.ts
index 05a60e94b..3e162af1a 100644
--- a/src/lib/strings/time.ts
+++ b/src/lib/strings/time.ts
@@ -23,7 +23,7 @@ export function ago(date: number | string | Date): string {
   } else if (diffSeconds < DAY) {
     return `${Math.floor(diffSeconds / HOUR)}h`
   } else if (diffSeconds < MONTH) {
-    return `${Math.floor(diffSeconds / DAY)}d`
+    return `${Math.round(diffSeconds / DAY)}d`
   } else if (diffSeconds < YEAR) {
     return `${Math.floor(diffSeconds / MONTH)}mo`
   } else {