Skip to content
Permalink
Browse files

Display local time for all time zone groups

  • Loading branch information...
alisdair committed Jul 4, 2015
1 parent 5d755be commit 4d16a3be0b3b5aafc384a00c14f157e6c9e980a1
Showing with 12 additions and 11 deletions.
  1. +1 −0 .jshintrc
  2. +1 −0 Brocfile.js
  3. +8 −10 app/components/timezone-group.js
  4. +2 −1 bower.json
@@ -1,5 +1,6 @@
{
"predef": [
"moment",
"server",
"document",
"window",
@@ -16,5 +16,6 @@ var app = new EmberApp();
// modules that you would like to import into your application
// please specify an object with the list of modules as keys
// along with the exports of each module as its value.
app.import('bower_components/moment/moment.js');

module.exports = app.toTree();
@@ -6,19 +6,17 @@ export default Ember.Component.extend({
users: [],
timezoneOffset: 0,

timezone: Ember.computed('timezoneOffset', function() {
let tz = this.get('timezoneOffset');
let sign = tz < 0 ? '-' : '+';
let offset = Math.abs(tz);
let hours = Math.trunc(offset / 3600);
let minutes = (offset % 3600) / 60;
let pad = i => (`0${i}`).slice(-2);
localtime: Ember.computed('timezoneOffset', function() {
let offset = this.get('timezoneOffset') / 60;
return moment().utcOffset(offset);
}).readOnly(),

return `${sign}${pad(hours)}:${pad(minutes)}`;
timezone: Ember.computed('localtime', function() {
return this.get('localtime').format('Z');
}).readOnly(),

time: Ember.computed('timezoneOffset', function() {
return '13:53';
time: Ember.computed('localtime', function() {
return this.get('localtime').format('HH:mm');
}).readOnly()
});

@@ -17,7 +17,8 @@
"ember-inflector": "~1.3.1",
"lodash": "~3.7.0",
"route-recognizer": "tildeio/route-recognizer#master",
"normalize.css": "~3.0.3"
"normalize.css": "~3.0.3",
"moment": "~2.10.3"
},
"resolutions": {
"route-recognizer": "master"

0 comments on commit 4d16a3b

Please sign in to comment.
You can’t perform that action at this time.