`<MessageTimestamp>`: make `timestamp` prop required

This commit is contained in:
Evan Hahn 2022-03-03 22:35:59 -06:00 committed by GitHub
parent 26100ea562
commit a3b1b696db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 7 deletions

View File

@ -41,7 +41,7 @@ const times = (): Array<[string, number]> => [
const createProps = (overrideProps: Partial<Props> = {}): Props => ({
i18n,
timestamp: overrideProps.timestamp,
timestamp: overrideProps.timestamp || Date.now(),
now: Date.now(),
module: text('module', ''),
withImageNoCaption: boolean('withImageNoCaption', false),

View File

@ -12,7 +12,7 @@ import { Time } from '../Time';
export type Props = {
now: number;
timestamp?: number;
timestamp: number;
module?: string;
withImageNoCaption?: boolean;
withSticker?: boolean;
@ -30,13 +30,9 @@ export function MessageTimestamp({
withImageNoCaption,
withSticker,
withTapToViewExpired,
}: Readonly<Props>): null | ReactElement {
}: Readonly<Props>): ReactElement {
const moduleName = module || 'module-timestamp';
if (timestamp === null || timestamp === undefined) {
return null;
}
return (
<Time
className={classNames(