projects
/
lemmy-ui.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
da4fd7e
)
Temp fix to modlog failing to render future dates (#2058)
author
Anon
<makotech222@users.noreply.github.com>
Sun, 13 Aug 2023 02:46:26 +0000
(21:46 -0500)
committer
GitHub
<noreply@github.com>
Sun, 13 Aug 2023 02:46:26 +0000
(22:46 -0400)
src/shared/utils/helpers/format-past-date.ts
patch
|
blob
|
history
diff --git
a/src/shared/utils/helpers/format-past-date.ts
b/src/shared/utils/helpers/format-past-date.ts
index 5bef4e83d1d0f678ed06958d3aafd95bc82465e0..02944a8864b220145260c8ed1642adf362d8a272 100644
(file)
--- 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";
+ }
}