Use UTC timestamps and add data attribute for easy targeting in tests
This commit is contained in:
parent
6005fcfc55
commit
a4cdde6f53
2 changed files with 17 additions and 10 deletions
|
@ -49,6 +49,10 @@ export class BaseMessageTile extends SimpleTile {
|
||||||
return `https://matrix.to/#/${encodeURIComponent(this.sender)}`;
|
return `https://matrix.to/#/${encodeURIComponent(this.sender)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get eventId() {
|
||||||
|
return this._entry.id;
|
||||||
|
}
|
||||||
|
|
||||||
get displayName() {
|
get displayName() {
|
||||||
return this._entry.displayName || this.sender;
|
return this._entry.displayName || this.sender;
|
||||||
}
|
}
|
||||||
|
@ -79,11 +83,11 @@ export class BaseMessageTile extends SimpleTile {
|
||||||
}
|
}
|
||||||
|
|
||||||
get date() {
|
get date() {
|
||||||
return this._date && this._date.toLocaleDateString({}, {month: "numeric", day: "numeric"});
|
return this._date && this._date.toLocaleDateString({}, {month: "numeric", day: "numeric", timeZone: 'UTC'});
|
||||||
}
|
}
|
||||||
|
|
||||||
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", timeZone: 'UTC'});
|
||||||
}
|
}
|
||||||
|
|
||||||
get isOwn() {
|
get isOwn() {
|
||||||
|
|
|
@ -40,14 +40,17 @@ export class BaseMessageView extends TemplateView {
|
||||||
if (this._interactive) {
|
if (this._interactive) {
|
||||||
children.push(t.button({className: "Timeline_messageOptions"}, "⋯"));
|
children.push(t.button({className: "Timeline_messageOptions"}, "⋯"));
|
||||||
}
|
}
|
||||||
const li = t.el(this._tagName, {className: {
|
const li = t.el(this._tagName, {
|
||||||
"Timeline_message": true,
|
className: {
|
||||||
own: vm.isOwn,
|
"Timeline_message": true,
|
||||||
unsent: vm.isUnsent,
|
own: vm.isOwn,
|
||||||
unverified: vm.isUnverified,
|
unsent: vm.isUnsent,
|
||||||
disabled: !this._interactive,
|
unverified: vm.isUnverified,
|
||||||
continuation: vm => vm.isContinuation,
|
disabled: !this._interactive,
|
||||||
}}, children);
|
continuation: vm => vm.isContinuation,
|
||||||
|
},
|
||||||
|
'data-event-id': vm.eventId
|
||||||
|
}, children);
|
||||||
// given that there can be many tiles, we don't add
|
// given that there can be many tiles, we don't add
|
||||||
// unneeded DOM nodes in case of a continuation, and we add it
|
// unneeded DOM nodes in case of a continuation, and we add it
|
||||||
// with a side-effect binding to not have to create sub views,
|
// with a side-effect binding to not have to create sub views,
|
||||||
|
|
Reference in a new issue