2015-06-23 15:41:25 +00:00
|
|
|
/*
|
2016-01-07 04:17:56 +00:00
|
|
|
Copyright 2015, 2016 OpenMarket Ltd
|
2018-01-14 18:35:53 +00:00
|
|
|
Copyright 2018 Michael Telatynski <7t3chguy@gmail.com>
|
2015-06-23 15:41:25 +00:00
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
2017-06-07 09:19:58 +00:00
|
|
|
import React from 'react';
|
2018-01-14 18:35:53 +00:00
|
|
|
import PropTypes from 'prop-types';
|
2018-01-10 21:50:32 +00:00
|
|
|
import {formatFullDate, formatTime} from 'matrix-react-sdk/lib/DateUtils';
|
2015-06-16 10:58:03 +00:00
|
|
|
|
2018-01-14 18:35:53 +00:00
|
|
|
export class MessageTimestamp extends React.Component {
|
|
|
|
static propTypes = {
|
|
|
|
ts: PropTypes.number.isRequired,
|
|
|
|
showTwelveHour: PropTypes.bool,
|
|
|
|
};
|
2017-05-19 21:29:06 +00:00
|
|
|
|
2018-01-14 18:35:53 +00:00
|
|
|
render() {
|
2017-05-19 21:29:06 +00:00
|
|
|
const date = new Date(this.props.ts);
|
|
|
|
return (
|
2018-01-14 18:35:53 +00:00
|
|
|
<span className="mx_MessageTimestamp" title={formatFullDate(date, this.props.showTwelveHour)}>
|
2018-01-10 21:50:32 +00:00
|
|
|
{ formatTime(date, this.props.showTwelveHour) }
|
2017-05-19 21:29:06 +00:00
|
|
|
</span>
|
|
|
|
);
|
2018-01-14 18:35:53 +00:00
|
|
|
}
|
|
|
|
}
|