From a70245a3b1edcf78db62b8815433aa91026c8eeb Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Wed, 8 Dec 2021 21:52:25 +0530 Subject: [PATCH] Fix date in same day Signed-off-by: Ajay Bura --- src/client/state/RoomTimeline.js | 1 + src/util/common.js | 6 +----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/client/state/RoomTimeline.js b/src/client/state/RoomTimeline.js index ea7376ad..b6800ab1 100644 --- a/src/client/state/RoomTimeline.js +++ b/src/client/state/RoomTimeline.js @@ -90,6 +90,7 @@ class RoomTimeline extends EventEmitter { } canPaginateBackward() { + if (this.timeline[0].getType() === 'm.room.create') return false; const tm = getFirstLinkedTimeline(this.activeTimeline); return tm.getPaginationToken('b') !== null; } diff --git a/src/util/common.js b/src/util/common.js index 8932aa6c..d7f4c365 100644 --- a/src/util/common.js +++ b/src/util/common.js @@ -14,11 +14,7 @@ export function diffMinutes(dt2, dt1) { } export function isInSameDay(dt2, dt1) { - return ( - dt2.getDay() === dt1.getDay() - && dt2.getMonth() === dt1.getMonth() - && dt2.getYear() === dt1.getYear() - ); + return (dt2.setHours(0, 0, 0, 0) === dt1.setHours(0, 0, 0, 0)); } export function getEventCords(ev) {