display last online time (#1125)

* - if offline calculate and display last online time to address https://github.com/owncast/owncast/issues/1111
- clean up status bar styles

* clean up console
This commit is contained in:
gingervitis
2021-06-20 10:49:16 -07:00
committed by GitHub
parent d19ecab90c
commit c45e43c378
6 changed files with 58 additions and 44 deletions

View File

@ -9,6 +9,7 @@ import {
} from '../../utils/user-colors.js';
import { convertToText } from '../../utils/chat.js';
import { SOCKET_MESSAGE_TYPES } from '../../utils/websocket.js';
import { getDiffInDaysFromNow } from '../../utils/helpers.js';
export default class ChatMessageView extends Component {
constructor(props) {
@ -155,7 +156,7 @@ function formatTimestamp(sentAt) {
return '';
}
let diffInDays = (new Date() - sentAt) / (24 * 3600 * 1000);
let diffInDays = getDiffInDaysFromNow(sentAt); //(new Date() - sentAt) / (24 * 3600 * 1000);
if (diffInDays >= 1) {
return (
`Sent at ${sentAt.toLocaleDateString('en-US', {