mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
move date up to SimpleTile
we'll need it to see if we have a date separator
This commit is contained in:
parent
12e378eb62
commit
27fd2739fe
@ -21,7 +21,6 @@ import {getIdentifierColorNumber, avatarInitials, getAvatarHttpUrl} from "../../
|
|||||||
export class BaseMessageTile extends SimpleTile {
|
export class BaseMessageTile extends SimpleTile {
|
||||||
constructor(entry, options) {
|
constructor(entry, options) {
|
||||||
super(entry, options);
|
super(entry, options);
|
||||||
this._date = this._entry.timestamp ? new Date(this._entry.timestamp) : null;
|
|
||||||
this._isContinuation = false;
|
this._isContinuation = false;
|
||||||
this._reactions = null;
|
this._reactions = null;
|
||||||
this._replyTile = null;
|
this._replyTile = null;
|
||||||
@ -78,10 +77,6 @@ export class BaseMessageTile extends SimpleTile {
|
|||||||
return this.sender;
|
return this.sender;
|
||||||
}
|
}
|
||||||
|
|
||||||
get date() {
|
|
||||||
return this._date && this._date.toLocaleDateString({}, {month: "numeric", day: "numeric"});
|
|
||||||
}
|
|
||||||
|
|
||||||
get time() {
|
get time() {
|
||||||
return this._date && this._date.toLocaleTimeString({}, {hour: "numeric", minute: "2-digit"});
|
return this._date && this._date.toLocaleTimeString({}, {hour: "numeric", minute: "2-digit"});
|
||||||
}
|
}
|
||||||
|
@ -22,6 +22,7 @@ export class SimpleTile extends ViewModel {
|
|||||||
constructor(entry, options) {
|
constructor(entry, options) {
|
||||||
super(options);
|
super(options);
|
||||||
this._entry = entry;
|
this._entry = entry;
|
||||||
|
this._date = this._entry.timestamp ? new Date(this._entry.timestamp) : null;
|
||||||
this._emitUpdate = undefined;
|
this._emitUpdate = undefined;
|
||||||
}
|
}
|
||||||
// view model props for all subclasses
|
// view model props for all subclasses
|
||||||
@ -45,6 +46,10 @@ export class SimpleTile extends ViewModel {
|
|||||||
return this._entry.asEventKey();
|
return this._entry.asEventKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get date() {
|
||||||
|
return this._date && this._date.toLocaleDateString({}, {weekday: 'long', year: 'numeric', month: 'long', day: 'numeric'});
|
||||||
|
}
|
||||||
|
|
||||||
get eventId() {
|
get eventId() {
|
||||||
return this._entry.id;
|
return this._entry.id;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user