Date display fixes

This commit is contained in:
mrfry 2021-05-30 10:53:18 +02:00
parent 5369f942f6
commit 18f0608c30
3 changed files with 15 additions and 4 deletions

View file

@ -41,6 +41,7 @@ function Comment({ comment, index, onComment, onDelete, onReact, uid }) {
const [displayed, setDisplayed] = useState(true)
const [commenting, setCommenting] = useState(false)
const { content, subComments, date, user, reacts, admin } = comment
const dateObj = new Date(date)
const own = uid === user
const commentStyle = admin
@ -67,9 +68,13 @@ function Comment({ comment, index, onComment, onDelete, onReact, uid }) {
User #{user}
</a>
</Link>
<div className={styles.newsDate}> @ {date}</div>
</div>
<div className={styles.commentDate}>{date}</div>
<div className={styles.commentDate} title={dateObj.toLocaleString()}>
@
{dateObj.getDate() !== new Date().getDate()
? dateObj.toLocaleDateString()
: dateObj.toLocaleTimeString()}
</div>
</div>
<div className={`${!displayed && styles.hidden}`}>
<div className={styles.commentText}> {content}</div>