From 73a4a967f550d5fb9eee0b1a0fca47b6dc406c8d Mon Sep 17 00:00:00 2001 From: Absurdon Date: Fri, 10 Mar 2017 22:09:12 +0100 Subject: [PATCH] Made timestamps on messages locale dependent --- app/javascripts/components/message.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/javascripts/components/message.js b/app/javascripts/components/message.js index 0ee95bd..7a96ea4 100644 --- a/app/javascripts/components/message.js +++ b/app/javascripts/components/message.js @@ -340,6 +340,15 @@ const ChatMessage = React.createClass({ ); }, + messageTime() { + let self = this; + let ts = new Date(self.props.message.createdAt); + let t = ts.toLocaleTimeString(undefined,{hour:"2-digit", minute:"2-digit"}); + let d = ts.toLocaleDateString(undefined,{month: "2-digit", day:"2-digit"}); + let r = ""; + return r.concat(d," ", t); + }, + render() { let deleteButton; let user = this.props.user; @@ -362,7 +371,7 @@ const ChatMessage = React.createClass({ - {moment(this.props.message.createdAt).format("LT DD/MM")}  + {this.messageTime()} {deleteButton}