Use nice human readable dates

parent b424de91
......@@ -5,6 +5,7 @@ module("browser_handler", function (require, exports) {
debug = require("debug"),
query = require("peppy").query,
Raphael = require("Raphael"),
moment = require("moment"),
sede,
sedeValue,
......@@ -127,6 +128,8 @@ module("browser_handler", function (require, exports) {
/* DOM Selecting initialization */
main(function () {
moment.locale('it');
sede = $("#sede")[0];
sedeValue = $("#sede .value")[0];
sedeTimestamp = $("#sede .timestamp")[0];
......@@ -165,7 +168,7 @@ module("browser_handler", function (require, exports) {
changeFAB(value);
doc.title = capitalize(value) + " " + title;
sedeValue.setAttribute("class", value + " value");
sedeTimestamp.innerHTML = status.timestamp;
sedeTimestamp.innerHTML = moment(status.timestamp).startOf('hour').fromNow();
sedeModifiedBy.innerHTML = status.modifiedby;
}
......@@ -178,7 +181,7 @@ module("browser_handler", function (require, exports) {
hide(msg);
}
msgUser.innerHTML = message.user;
msgTimestamp.innerHTML = message.timestamp;
msgTimestamp.innerHTML = moment(message.timestamp).startOf('hour').fromNow();
msgValue.innerHTML = message.value;
}
......
This diff is collapsed.
......@@ -49,6 +49,7 @@ class DynamicPage(tornado.web.UIModule):
return (
'/static/module.js?v=1',
'/static/lib/raphael-min.js?v=1',
'/static/lib/moment-with-locales.js?v=1',
'/static/lib/g.raphael-min.js?v=1',
'/static/lib/g.line-min.js?v=1',
'/static/lib/json2.js?v=2',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment