mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-29 00:42:34 +00:00
Temp fix to modlog failing to render future dates (#2058)
This commit is contained in:
parent
da4fd7e39e
commit
f27cbb3224
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue