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

use differenceForAvoidingFormat props

Shun Miyazawa 4 лет назад
Родитель
Сommit
2669bee0eb

+ 1 - 3
packages/app/src/components/FormattedDistanceDate.jsx

@@ -14,7 +14,7 @@ const FormattedDistanceDate = (props) => {
   const dateFormatted = format(date, 'yyyy/MM/dd HH:mm');
 
   const diff = Math.abs(differenceInSeconds(date, baseDate));
-  if (!props.isNotShowDate && diff > props.differenceForAvoidingFormat) {
+  if (diff > props.differenceForAvoidingFormat) {
     return <>{dateFormatted}</>;
   }
 
@@ -35,12 +35,10 @@ FormattedDistanceDate.propTypes = {
   // the number(sec) from 'baseDate' to avoid format
   differenceForAvoidingFormat: PropTypes.number,
   isShowTooltip: PropTypes.bool,
-  isNotShowDate: PropTypes.bool,
 };
 FormattedDistanceDate.defaultProps = {
   differenceForAvoidingFormat: 86400 * 3,
   isShowTooltip: true,
-  isNotShowDate: false,
 };
 
 export default FormattedDistanceDate;

+ 6 - 1
packages/app/src/components/InAppNotification/InAppNotificationElm.tsx

@@ -101,7 +101,12 @@ const InAppNotificationElm = (props: Props): JSX.Element => {
             <b>{actionUsers}</b> {actionMsg} <PagePathLabel page={pagePath} />
           </div>
           <i className={`${actionIcon} mr-2`} />
-          <FormattedDistanceDate id={notification._id} date={notification.createdAt} isShowTooltip={false} isNotShowDate />
+          <FormattedDistanceDate
+            id={notification._id}
+            date={notification.createdAt}
+            isShowTooltip={false}
+            differenceForAvoidingFormat={Number.POSITIVE_INFINITY}
+          />
         </div>
       </div>
     </div>