mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-22 20:31:13 +00:00
Temp fix to modlog failing to render future dates (#2058)
This commit is contained in:
parent
da4fd7e39e
commit
f27cbb3224
1 changed files with 7 additions and 3 deletions
|
@ -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