forked from matrix/element-web
refactor MessageTimestamp, as it was missing a PropTypes def for ts
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
22c024cc94
commit
b65fdf6ab0
|
@ -1,5 +1,6 @@
|
||||||
/*
|
/*
|
||||||
Copyright 2015, 2016 OpenMarket Ltd
|
Copyright 2015, 2016 OpenMarket Ltd
|
||||||
|
Copyright 2018 Michael Telatynski <7t3chguy@gmail.com>
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License");
|
Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
you may not use this file except in compliance with the License.
|
you may not use this file except in compliance with the License.
|
||||||
|
@ -14,24 +15,22 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
import {formatFullDate, formatTime} from 'matrix-react-sdk/lib/DateUtils';
|
import {formatFullDate, formatTime} from 'matrix-react-sdk/lib/DateUtils';
|
||||||
|
|
||||||
module.exports = React.createClass({
|
export class MessageTimestamp extends React.Component {
|
||||||
displayName: 'MessageTimestamp',
|
static propTypes = {
|
||||||
|
ts: PropTypes.number.isRequired,
|
||||||
|
showTwelveHour: PropTypes.bool,
|
||||||
|
};
|
||||||
|
|
||||||
propTypes: {
|
render() {
|
||||||
showTwelveHour: React.PropTypes.bool,
|
|
||||||
},
|
|
||||||
|
|
||||||
render: function() {
|
|
||||||
const date = new Date(this.props.ts);
|
const date = new Date(this.props.ts);
|
||||||
return (
|
return (
|
||||||
<span className="mx_MessageTimestamp" title={ formatFullDate(date, this.props.showTwelveHour) }>
|
<span className="mx_MessageTimestamp" title={formatFullDate(date, this.props.showTwelveHour)}>
|
||||||
{ formatTime(date, this.props.showTwelveHour) }
|
{ formatTime(date, this.props.showTwelveHour) }
|
||||||
</span>
|
</span>
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
Loading…
Reference in New Issue