Show full date

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner 2021-02-25 08:20:34 +01:00
parent 83de84972e
commit b18622efe4
No known key found for this signature in database
GPG Key ID: 9760693FDD98A790
2 changed files with 9 additions and 4 deletions

View File

@ -30,7 +30,7 @@ import MessageContextMenu from "../context_menus/MessageContextMenu";
import {aboveLeftOf, ContextMenu} from '../../structures/ContextMenu';
import MessageTimestamp from "../messages/MessageTimestamp";
import SettingsStore from "../../../settings/SettingsStore";
import {formatTime} from "../../../DateUtils";
import {formatFullDate} from "../../../DateUtils";
import dis from '../../../dispatcher/dispatcher';
export default class ImageView extends React.Component {
@ -286,9 +286,9 @@ export default class ImageView extends React.Component {
<a
href={permalink}
onClick={this.onPermalinkClicked}
aria-label={formatTime(new Date(this.props.mxEvent.getTs()), this.props.isTwelveHour)}
aria-label={formatFullDate(new Date(this.props.mxEvent.getTs()), this.props.isTwelveHour)}
>
<MessageTimestamp showTwelveHour={showTwelveHour} ts={mxEvent.getTs()} />
<MessageTimestamp showFullDate={true} showTwelveHour={showTwelveHour} ts={mxEvent.getTs()} />
</a>
);

View File

@ -23,13 +23,18 @@ export default class MessageTimestamp extends React.Component {
static propTypes = {
ts: PropTypes.number.isRequired,
showTwelveHour: PropTypes.bool,
showFullDate: PropTypes.bool,
};
render() {
const date = new Date(this.props.ts);
return (
<span className="mx_MessageTimestamp" title={formatFullDate(date, this.props.showTwelveHour)} aria-hidden={true}>
{ formatTime(date, this.props.showTwelveHour) }
{
this.props.showFullDate ?
formatFullDate(date, this.props.showTwelveHour) :
formatTime(date, this.props.showTwelveHour)
}
</span>
);
}