diff --git a/src/components/ui/DateDivider.tsx b/src/components/ui/DateDivider.tsx
index b2d69031..5bbec51c 100644
--- a/src/components/ui/DateDivider.tsx
+++ b/src/components/ui/DateDivider.tsx
@@ -37,15 +37,15 @@ const Unread = styled.div`
`;
interface Props {
- date: Date;
+ date?: Date;
unread?: boolean;
}
-export default function DateDivider(props: Props) {
+export default function DateDivider({ unread, date }: Props) {
return (
-
- {props.unread && NEW}
-
+
+ {unread && NEW}
+ {date && }
);
}
diff --git a/src/pages/channels/messaging/MessageRenderer.tsx b/src/pages/channels/messaging/MessageRenderer.tsx
index 7ed45c59..9b1577c8 100644
--- a/src/pages/channels/messaging/MessageRenderer.tsx
+++ b/src/pages/channels/messaging/MessageRenderer.tsx
@@ -104,6 +104,7 @@ export default observer(({ last_id, renderer, highlight }: Props) => {
prevAuthor: string,
previousMasq: Nullable,
) {
+ head = false;
const atime = decodeTime(current),
adate = new Date(atime),
btime = decodeTime(previous),
@@ -115,14 +116,17 @@ export default observer(({ last_id, renderer, highlight }: Props) => {
divided = true;
}
- head = false;
+ let date;
if (
- unread ||
adate.getFullYear() !== bdate.getFullYear() ||
adate.getMonth() !== bdate.getMonth() ||
adate.getDate() !== bdate.getDate()
) {
- render.push();
+ date = adate;
+ }
+
+ if (unread || date) {
+ render.push();
head = true;
}