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");
}
);

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

@ -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"
}
}