From b65fdf6ab0572b5ebe26636897736fab9e4d7172 Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Sun, 14 Jan 2018 18:35:53 +0000 Subject: [PATCH] refactor MessageTimestamp, as it was missing a PropTypes def for ts Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- .../views/messages/MessageTimestamp.js | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/components/views/messages/MessageTimestamp.js b/src/components/views/messages/MessageTimestamp.js index 3d972e4c16..eafa25daf1 100644 --- a/src/components/views/messages/MessageTimestamp.js +++ b/src/components/views/messages/MessageTimestamp.js @@ -1,5 +1,6 @@ /* Copyright 2015, 2016 OpenMarket Ltd +Copyright 2018 Michael Telatynski <7t3chguy@gmail.com> Licensed under the Apache License, Version 2.0 (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. */ -'use strict'; - import React from 'react'; +import PropTypes from 'prop-types'; import {formatFullDate, formatTime} from 'matrix-react-sdk/lib/DateUtils'; -module.exports = React.createClass({ - displayName: 'MessageTimestamp', +export class MessageTimestamp extends React.Component { + static propTypes = { + ts: PropTypes.number.isRequired, + showTwelveHour: PropTypes.bool, + }; - propTypes: { - showTwelveHour: React.PropTypes.bool, - }, - - render: function() { + render() { const date = new Date(this.props.ts); return ( - + { formatTime(date, this.props.showTwelveHour) } ); - }, -}); + } +}