From 446cf2d3e44f86a2c3457f78ab7e239a19bc9cb5 Mon Sep 17 00:00:00 2001 From: Alejandro Gomez Date: Mon, 9 Jan 2023 22:23:34 +0100 Subject: [PATCH] pluralize note time --- src/element/NoteReaction.css | 1 + src/element/NoteTime.js | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/element/NoteReaction.css b/src/element/NoteReaction.css index 13984c9b6..e99fd2ab2 100644 --- a/src/element/NoteReaction.css +++ b/src/element/NoteReaction.css @@ -19,5 +19,6 @@ } .reaction > .header > .info { + color: #999; font-size: small; } \ No newline at end of file diff --git a/src/element/NoteTime.js b/src/element/NoteTime.js index b260f387b..9b2ebc77b 100644 --- a/src/element/NoteTime.js +++ b/src/element/NoteTime.js @@ -16,9 +16,12 @@ export default function NoteTime(props) { return fromDate.toLocaleDateString(undefined, { year: "2-digit", month: "short", day: "2-digit", weekday: "short" }); } else if (absAgo > HourInMs) { return `${fromDate.getHours().toString().padStart(2, '0')}:${fromDate.getMinutes().toString().padStart(2, '0')}`; + } else if (absAgo < MinuteInMs) { + return 'Just now' } else { let mins = parseInt(absAgo / MinuteInMs); - return `${mins} mins ago`; + let minutes = mins === 1 ? 'min' : 'mins' + return `${mins} ${minutes} ago`; } }