Use a hook for the ever-updating now

This commit is contained in:
Josh Perez 2022-03-08 14:11:11 -05:00 committed by GitHub
parent f8724e91da
commit 4e48d7792b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 34 additions and 78 deletions

View file

@ -9,9 +9,9 @@ import { formatTime } from '../../util/timestamp';
import type { LocalizerType } from '../../types/Util';
import { Time } from '../Time';
import { useNowThatUpdatesEveryMinute } from '../../hooks/useNowThatUpdatesEveryMinute';
export type Props = {
now: number;
timestamp: number;
module?: string;
withImageNoCaption?: boolean;
@ -25,12 +25,12 @@ export function MessageTimestamp({
direction,
i18n,
module,
now,
timestamp,
withImageNoCaption,
withSticker,
withTapToViewExpired,
}: Readonly<Props>): ReactElement {
const now = useNowThatUpdatesEveryMinute();
const moduleName = module || 'module-timestamp';
return (