mirror of
https://github.com/LemmyNet/lemmy-ui.git
synced 2024-11-01 01:59:56 +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) {
|
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";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue