Просмотр исходного кода

Merge pull request #2457 from weseek/imprv/readable-expired-at

Imprv/readable expired at
Yuki Takei 5 лет назад
Родитель
Сommit
f4905bbe90

+ 2 - 1
src/client/js/components/Admin/Security/ShareLinkSetting.jsx

@@ -1,6 +1,7 @@
 import React, { Fragment } from 'react';
 import PropTypes from 'prop-types';
 import { withTranslation } from 'react-i18next';
+import dateFnsFormat from 'date-fns/format';
 
 import { withUnstatedContainers } from '../../UnstatedUtils';
 import { toastSuccess, toastError } from '../../../util/apiNotification';
@@ -134,7 +135,7 @@ class ShareLinkSetting extends React.Component {
                   <tr key={sharelink._id}>
                     <td>{sharelink._id}</td>
                     <td><a href={sharelink.relatedPage.path}>{sharelink.relatedPage.path}</a></td>
-                    <td>{sharelink.expiredAt}</td>
+                    <td>{sharelink.expiredAt && <span>{dateFnsFormat(new Date(sharelink.expiredAt), 'yyyy-MM-dd HH:mm')}</span>}</td>
                     <td>{sharelink.description}</td>
                     <td>
                       <button

+ 2 - 1
src/client/js/components/ShareLinkList.jsx

@@ -3,6 +3,7 @@ import PropTypes from 'prop-types';
 
 
 import { withTranslation } from 'react-i18next';
+import dateFnsFormat from 'date-fns/format';
 
 import { withUnstatedContainers } from './UnstatedUtils';
 
@@ -23,7 +24,7 @@ const ShareLinkList = (props) => {
         {props.shareLinks.map(shareLink => (
           <tr key={shareLink._id}>
             <td>{shareLink._id}</td>
-            <td>{shareLink.expiredAt}</td>
+            <td>{shareLink.expiredAt && <span>{dateFnsFormat(new Date(shareLink.expiredAt), 'yyyy-MM-dd HH:mm')}</span>}</td>
             <td>{shareLink.description}</td>
             <td>
               <button className="btn btn-outline-warning" type="button" onClick={() => deleteLinkHandler(shareLink._id)}>