move date up to SimpleTile

we'll need it to see if we have a date separator
This commit is contained in:
Bruno Windels 2022-06-25 12:36:39 +02:00
parent 12e378eb62
commit 27fd2739fe
2 changed files with 5 additions and 5 deletions

View File

@ -21,7 +21,6 @@ import {getIdentifierColorNumber, avatarInitials, getAvatarHttpUrl} from "../../
export class BaseMessageTile extends SimpleTile {
constructor(entry, options) {
super(entry, options);
this._date = this._entry.timestamp ? new Date(this._entry.timestamp) : null;
this._isContinuation = false;
this._reactions = null;
this._replyTile = null;
@ -78,10 +77,6 @@ export class BaseMessageTile extends SimpleTile {
return this.sender;
}
get date() {
return this._date && this._date.toLocaleDateString({}, {month: "numeric", day: "numeric"});
}
get time() {
return this._date && this._date.toLocaleTimeString({}, {hour: "numeric", minute: "2-digit"});
}

View File

@ -22,6 +22,7 @@ export class SimpleTile extends ViewModel {
constructor(entry, options) {
super(options);
this._entry = entry;
this._date = this._entry.timestamp ? new Date(this._entry.timestamp) : null;
this._emitUpdate = undefined;
}
// view model props for all subclasses
@ -45,6 +46,10 @@ export class SimpleTile extends ViewModel {
return this._entry.asEventKey();
}
get date() {
return this._date && this._date.toLocaleDateString({}, {weekday: 'long', year: 'numeric', month: 'long', day: 'numeric'});
}
get eventId() {
return this._entry.id;
}