From 01db851785997c725a920010d886c6ec19406f23 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Fri, 29 Sep 2023 07:43:30 -0400 Subject: [PATCH] Revert "Added error handling to format-past-date to prevent timeouts on modlog (#2083)" This reverts commit 02bb1b84e1220cbf25b25eaabf1017083906b277. --- src/shared/utils/helpers/format-past-date.ts | 23 ++++---------------- 1 file changed, 4 insertions(+), 19 deletions(-) diff --git a/src/shared/utils/helpers/format-past-date.ts b/src/shared/utils/helpers/format-past-date.ts index 1e0ffda8..5bef4e83 100644 --- a/src/shared/utils/helpers/format-past-date.ts +++ b/src/shared/utils/helpers/format-past-date.ts @@ -2,23 +2,8 @@ import formatDistanceStrict from "date-fns/formatDistanceStrict"; import parseISO from "date-fns/parseISO"; export default function (dateString?: string) { - if (!dateString) { - console.error(err); - return "DATE ERROR"; - } - - try { - const parsed = parseISO(Date.now().toString() + "Z"); - return formatDistanceStrict(parsed, new Date(), { - addSuffix: true, - }); - } catch (err) { - console.error(err); - if (err instanceof RangeError) { - console.error( - `Got the invalid value of ${dateString} when attempting to parse to ISO date`, - ); - return "DATE ERROR"; - } - } + const parsed = parseISO((dateString ?? Date.now().toString()) + "Z"); + return formatDistanceStrict(parsed, new Date(), { + addSuffix: true, + }); }