Added timestamps

This commit is contained in:
Mattias Erming 2014-03-07 00:17:08 +01:00
parent ccba766dbe
commit acfeac27f4
2 changed files with 19 additions and 4 deletions

View File

@ -1,4 +1,5 @@
var _ = require("lodash"); var _ = require("lodash");
var moment = require("moment");
var models = exports; var models = exports;
var id = 0; var id = 0;
@ -40,9 +41,9 @@ models.User = function(attr) {
models.Message = function(attr) { models.Message = function(attr) {
attr = attr || {}; attr = attr || {};
_.extend(this, _.defaults(attr, { _.extend(this, _.defaults(attr, {
text: "", time: moment().format("HH:mm"),
time: "", user: "",
user: "" text: ""
})); }));
}; };

View File

@ -1,14 +1,28 @@
{ {
"name": "chat",
"description": "A web-based client/server IRC chat",
"author": { "author": {
"name": "Mattias Erming", "name": "Mattias Erming",
"email": "mattias@mattiaserming.com" "email": "mattias@mattiaserming.com"
}, },
"description": "A web-based client/server IRC chat",
"dependencies": { "dependencies": {
"commander": "2.1.0", "commander": "2.1.0",
"connect": "2.13.0", "connect": "2.13.0",
"irc": "0.3.6", "irc": "0.3.6",
"lodash": "2.4.1", "lodash": "2.4.1",
"moment": "2.5.1",
"socket.io": "0.9.16" "socket.io": "0.9.16"
},
"keywords": [
"chat",
"irc",
"server",
"web",
"browser"
],
"main": "./app.js",
"repository": {
"type": "git",
"url": "https://github.com/erming/chat.git"
} }
} }