mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
don't show date & time on pending events
This commit is contained in:
parent
9d260c692b
commit
fad728069a
@ -21,7 +21,7 @@ export class MessageTile extends SimpleTile {
|
|||||||
constructor(options) {
|
constructor(options) {
|
||||||
super(options);
|
super(options);
|
||||||
this._isOwn = this._entry.sender === options.ownUserId;
|
this._isOwn = this._entry.sender === options.ownUserId;
|
||||||
this._date = new Date(this._entry.timestamp);
|
this._date = this._entry.timestamp ? new Date(this._entry.timestamp) : null;
|
||||||
this._isContinuation = false;
|
this._isContinuation = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -38,11 +38,11 @@ export class MessageTile extends SimpleTile {
|
|||||||
}
|
}
|
||||||
|
|
||||||
get date() {
|
get date() {
|
||||||
return this._date.toLocaleDateString({}, {month: "numeric", day: "numeric"});
|
return this._date && this._date.toLocaleDateString({}, {month: "numeric", day: "numeric"});
|
||||||
}
|
}
|
||||||
|
|
||||||
get time() {
|
get time() {
|
||||||
return this._date.toLocaleTimeString({}, {hour: "numeric", minute: "2-digit"});
|
return this._date && this._date.toLocaleTimeString({}, {hour: "numeric", minute: "2-digit"});
|
||||||
}
|
}
|
||||||
|
|
||||||
get isOwn() {
|
get isOwn() {
|
||||||
|
@ -20,7 +20,7 @@ import {renderMessage} from "./common.js";
|
|||||||
export class TextMessageView extends TemplateView {
|
export class TextMessageView extends TemplateView {
|
||||||
render(t, vm) {
|
render(t, vm) {
|
||||||
return renderMessage(t, vm,
|
return renderMessage(t, vm,
|
||||||
[t.p([vm.text, t.time(vm.date + " " + vm.time)])]
|
[t.p([vm.text, t.time({className: {hidden: !vm.date}}, vm.date + " " + vm.time)])]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user