Timestamp: Eliminate 'Invalid date' from potential output

This commit is contained in:
Scott Nonnenberg 2018-07-18 08:14:34 -07:00
parent 60f61c804b
commit 95976b10e7
2 changed files with 30 additions and 1 deletions

View file

@ -7,7 +7,7 @@ import { formatRelativeTime } from '../../util/formatRelativeTime';
import { Localizer } from '../../types/Util';
interface Props {
timestamp: number;
timestamp: number | null;
extended: boolean;
module?: string;
withImageNoCaption?: boolean;
@ -52,6 +52,10 @@ export class Timestamp extends React.Component<Props> {
} = this.props;
const moduleName = module || 'module-timestamp';
if (timestamp === null || timestamp === undefined) {
return null;
}
return (
<span
className={classNames(