kaori 4 лет назад
Родитель
Сommit
e0b84f1df7
1 измененных файлов с 18 добавлено и 2 удалено
  1. 18 2
      packages/app/src/components/Navbar/AuthorInfo.jsx

+ 18 - 2
packages/app/src/components/Navbar/AuthorInfo.jsx

@@ -24,7 +24,21 @@ const AuthorInfo = (props) => {
     : <i>Unknown</i>;
 
   if (locate === 'footer') {
-    return <p>{infoLabelForFooter} {format(new Date(date), formatType)} by <UserPicture user={user} size="sm" /> {userLabel}</p>;
+    try {
+      return <p>{infoLabelForFooter} {format(new Date(date), formatType)} by <UserPicture user={user} size="sm" /> {userLabel}</p>;
+    }
+    catch (err) {
+      return <p>{infoLabelForSubNav} <UserPicture user={user} size="sm" /> {userLabel}</p>;
+    }
+  }
+
+
+  let parsedDate;
+  if (date == null) {
+    parsedDate = '';
+  }
+  else {
+    parsedDate = format(new Date(date), formatType);
   }
 
   return (
@@ -34,7 +48,9 @@ const AuthorInfo = (props) => {
       </div>
       <div>
         <div>{infoLabelForSubNav} {userLabel}</div>
-        <div className="text-muted text-date">{format(new Date(date), formatType)}</div>
+        <div className="text-muted text-date">
+          {parsedDate}
+        </div>
       </div>
     </div>
   );