Skip to content
Browse files

correctly set timestamp

  • Loading branch information...
1 parent df2df9d commit 3101ea205fde78c05cc80e3f3ff0095443259306 @ry ry committed
Showing with 7 additions and 2 deletions.
  1. +7 −2 client.js
View
9 client.js
@@ -70,9 +70,14 @@ function scrollDown () {
function addMessage (from, text, time, _class) {
if (text === null)
return;
-
- if (time !== null)
+
+ if (time == null) {
+ // if the time is null or undefined, use the current time.
time = new Date();
+ } else if ((time instanceof Date) === false) {
+ // if it's a timestamp, interpret it
+ time = new Date(time);
+ }
var messageElement = $(document.createElement("table"));

0 comments on commit 3101ea2

Please sign in to comment.
Something went wrong with that request. Please try again.