From f27cbb3224e4092dc011624da7c822e940cd20f1 Mon Sep 17 00:00:00 2001 From: Anon Date: Sat, 12 Aug 2023 21:46:26 -0500 Subject: [PATCH] Temp fix to modlog failing to render future dates (#2058) --- src/shared/utils/helpers/format-past-date.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/shared/utils/helpers/format-past-date.ts b/src/shared/utils/helpers/format-past-date.ts index 5bef4e8..02944a8 100644 --- a/src/shared/utils/helpers/format-past-date.ts +++ b/src/shared/utils/helpers/format-past-date.ts @@ -3,7 +3,11 @@ import parseISO from "date-fns/parseISO"; export default function (dateString?: string) { const parsed = parseISO((dateString ?? Date.now().toString()) + "Z"); - return formatDistanceStrict(parsed, new Date(), { - addSuffix: true, - }); + try { + return formatDistanceStrict(parsed, new Date(), { + addSuffix: true, + }); + } catch (e) { + return "indeterminate"; + } } -- 2.44.1