Handle timezones

This commit is contained in:
Mattias Erming 2014-07-23 17:16:00 -07:00
parent 019a643f94
commit b7338eeab7
8 changed files with 2636 additions and 13 deletions

View file

@ -1,17 +1,23 @@
module.exports = function(grunt) {
var libs = "client/js/libs/**/*.js";
grunt.initConfig({
watch: {
files: libs,
tasks: ["uglify"]
},
uglify: {
options: {
compress: false
},
js: {
files: {
"client/js/libs.min.js": "client/js/libs/**/*.js"
"client/js/libs.min.js": libs
}
}
}
});
grunt.loadNpmTasks("grunt-contrib-uglify");
grunt.loadNpmTasks("grunt-contrib-watch");
grunt.registerTask(
"default",
["uglify"]

View file

@ -236,7 +236,7 @@
{{#each messages}}
<div class="msg {{type}}">
<span class="time">
{{time}}
{{tz time}}
</span>
<span class="from">
{{#if from}}

15
client/js/libs.min.js vendored

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,6 @@
Handlebars.registerHelper(
"tz", function(time) {
var utc = moment.utc(time, "HH:mm:ss").toDate();
return moment(utc).format("HH:mm");
}
);

View file

@ -13,7 +13,7 @@ Handlebars.registerHelper(
var urls = [];
text = URI.withinString(text, function(url) {
urls.push(url);
return "$(" + (urls.length - 1) + ")";
return "$(" + (urls.length - 1) + ")";
});
text = escape(text);
for (var i in urls) {

2610
client/js/libs/moment.js Normal file

File diff suppressed because it is too large Load diff

View file

@ -23,7 +23,7 @@ function Msg(attr) {
_.merge(this, _.extend({
from: "",
text: "",
time: moment().format("HH:mm"),
time: moment().utc().format("HH:mm:ss"),
type: Msg.Type.MESSAGE
}, attr));
}

View file

@ -20,7 +20,7 @@
"single-instance": false,
"window": {
"title": "Shout",
"icon": "client/img/favicon.png",
"icon": "client/img/favicon.png",
"toolbar": false,
"width": 1024,
"height": 640
@ -42,6 +42,6 @@
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-uglify": "~0.5.0",
"grunt-node-webkit-builder": "~0.1.21"
"grunt-contrib-watch": "^0.6.1"
}
}