From ecc4de33e8b20ef7f2decb1b0b037a3431685c74 Mon Sep 17 00:00:00 2001 From: lauvrenn Date: Sun, 8 Dec 2019 09:16:58 -0500 Subject: [PATCH] fix how-to plural dates --- .../Content/Howto/HowtoDescription/HowtoDescription.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/pages/Howto/Content/Howto/HowtoDescription/HowtoDescription.tsx b/src/pages/Howto/Content/Howto/HowtoDescription/HowtoDescription.tsx index 593e17c5cc..4ffc35ca71 100644 --- a/src/pages/Howto/Content/Howto/HowtoDescription/HowtoDescription.tsx +++ b/src/pages/Howto/Content/Howto/HowtoDescription/HowtoDescription.tsx @@ -28,7 +28,14 @@ export default class HowtoDescription extends React.PureComponent { public durationSincePosted(postDate: Date) { const daysSince: number = differenceInDays(new Date(), new Date(postDate)) - return `${daysSince} days ago` + switch (daysSince) { + case 0: + return 'today' + case 1: + return `${daysSince} day ago` + default: + return `${daysSince} days ago` + } } public render() {