From 9e9d7762c4239cd57bcde9ed212bfc1214cd1b84 Mon Sep 17 00:00:00 2001 From: Abishek PY <43115551+vj-abishek@users.noreply.github.com> Date: Mon, 1 Feb 2021 14:30:30 +0530 Subject: [PATCH 1/2] fix: date undefined issue --- src/Components/Home/Room/Single.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Components/Home/Room/Single.jsx b/src/Components/Home/Room/Single.jsx index 5a6e4af..fbdfdb2 100644 --- a/src/Components/Home/Room/Single.jsx +++ b/src/Components/Home/Room/Single.jsx @@ -2,7 +2,7 @@ import React, { useState, useEffect } from 'react'; import { Link, useParams } from 'react-router-dom'; import { Helmet } from 'react-helmet'; import { connect } from 'react-redux'; -import { format, formatDistanceToNow } from 'date-fns'; +import { format, formatDistanceToNow, isDate } from 'date-fns'; import E2E from '../../Utils/EndToEnd'; import Styles from '../../../Styles/responsive.module.css'; import { UpdateChannel } from '../../../Store/Actions/Channel'; @@ -146,6 +146,9 @@ const Single = ({ const message = lastMessage.get(snapShot.channelId); lastMessagetime = message.message?.time; } + + const checkDate = isDate(lastMessagetime) && (new Date(lastMessagetime) !=== 'Invalid Date') + return ( {snapShot.pro.data().displayName}