Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

correctly set timestamp

  • Loading branch information...
commit 3101ea205fde78c05cc80e3f3ff0095443259306 1 parent df2df9d
@ry ry authored
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"));
Please sign in to comment.
Something went wrong with that request. Please try again.