Temp fix to modlog failing to render future dates (#2058)

This commit is contained in:
Anon 2023-08-12 21:46:26 -05:00 committed by GitHub
parent da4fd7e39e
commit f27cbb3224
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,11 @@ import parseISO from "date-fns/parseISO";
export default function (dateString?: string) { export default function (dateString?: string) {
const parsed = parseISO((dateString ?? Date.now().toString()) + "Z"); const parsed = parseISO((dateString ?? Date.now().toString()) + "Z");
try {
return formatDistanceStrict(parsed, new Date(), { return formatDistanceStrict(parsed, new Date(), {
addSuffix: true, addSuffix: true,
}); });
} catch (e) {
return "indeterminate";
}
} }