소스 검색

Merge pull request #3351 from weseek/fix/5009-5010-fix-page-meta

Fix/5009 5010 fix page meta
itizawa 5 년 전
부모
커밋
07ed39c428
2개의 변경된 파일7개의 추가작업 그리고 6개의 파일을 삭제
  1. 1 1
      CHANGES.md
  2. 6 5
      src/client/js/components/Navbar/AuthorInfo.jsx

+ 1 - 1
CHANGES.md

@@ -2,7 +2,7 @@
 
 ## v4.2.8-RC
 
-* 
+* Fix: Fixed the display of updtedAt and createdAt being reversed 
 
 ## v4.2.7
 

+ 6 - 5
src/client/js/components/Navbar/AuthorInfo.jsx

@@ -1,10 +1,11 @@
 import React from 'react';
 import PropTypes from 'prop-types';
-
 import { userPageRoot } from '@commons/util/path-utils';
+import { format } from 'date-fns';
 
 import UserPicture from '../User/UserPicture';
 
+const formatType = 'yyyy/MM/dd HH:mm';
 const AuthorInfo = (props) => {
   const {
     mode, user, date, locate,
@@ -14,14 +15,14 @@ const AuthorInfo = (props) => {
     ? 'Created by'
     : 'Updated by';
   const infoLabelForFooter = mode === 'create'
-    ? 'Last revision posted at'
-    : 'Created at';
+    ? 'Created at'
+    : 'Last revision posted at';
   const userLabel = user != null
     ? <a href={userPageRoot(user)}>{user.name}</a>
     : <i>Unknown</i>;
 
   if (locate === 'footer') {
-    return <p>{infoLabelForFooter} {date} by <UserPicture user={user} size="sm" /> {userLabel}</p>;
+    return <p>{infoLabelForFooter} {format(new Date(date), formatType)} by <UserPicture user={user} size="sm" /> {userLabel}</p>;
   }
 
   return (
@@ -31,7 +32,7 @@ const AuthorInfo = (props) => {
       </div>
       <div>
         <div>{infoLabelForSubNav} {userLabel}</div>
-        <div className="text-muted text-date">{date}</div>
+        <div className="text-muted text-date">{format(new Date(date), formatType)}</div>
       </div>
     </div>
   );