RelativeDateCell PureComponent

This commit is contained in:
Mark McDowall 2019-02-28 18:39:12 -08:00
parent 4d389ae5ce
commit 22778091f9
1 changed files with 32 additions and 26 deletions

View File

@ -1,11 +1,16 @@
import PropTypes from 'prop-types';
import React from 'react';
import React, { PureComponent } from 'react';
import formatDateTime from 'Utilities/Date/formatDateTime';
import getRelativeDate from 'Utilities/Date/getRelativeDate';
import TableRowCell from './TableRowCell';
import styles from './RelativeDateCell.css';
function RelativeDateCell(props) {
class RelativeDateCell extends PureComponent {
//
// Render
render() {
const {
className,
date,
@ -17,7 +22,7 @@ function RelativeDateCell(props) {
component: Component,
dispatch,
...otherProps
} = props;
} = this.props;
if (!date) {
return (
@ -37,6 +42,7 @@ function RelativeDateCell(props) {
{getRelativeDate(date, shortDateFormat, showRelativeDates, { timeFormat, includeSeconds, timeForToday: true })}
</Component>
);
}
}
RelativeDateCell.propTypes = {