replace jstimezonedetect by moment.tz.guess() (#139)

Closes #118
This commit is contained in:
jelhan 2017-08-26 01:54:41 +02:00 committed by GitHub
parent 70ba444b39
commit ee6728314a
5 changed files with 6 additions and 12 deletions

View file

@ -4,7 +4,6 @@ import {
}
from 'ember-cp-validations';
import moment from 'moment';
/* global jstz */
const {
computed,
@ -55,7 +54,7 @@ export default Controller.extend(Validations, {
return !moment(option.get('title'), 'YYYY-MM-DD', true).isValid();
})
) {
this.set('model.timezone', jstz.determine().name());
this.set('model.timezone', moment.tz.guess());
}
// save poll

View file

@ -1,6 +1,5 @@
import Ember from 'ember';
import moment from 'moment';
/* global jstz */
const {
computed,
@ -84,7 +83,7 @@ export default Controller.extend({
*/
timezoneDiffers: computed('model.timezone', function() {
const modelTimezone = this.get('model.timezone');
return isPresent(modelTimezone) && jstz.determine().name() !== modelTimezone;
return isPresent(modelTimezone) && moment.tz.guess() !== modelTimezone;
}),
useLocalTimezone: false,

View file

@ -4,7 +4,6 @@
"sjcl": "~1.0.6",
"bootstrap": "~3.3.5",
"bootstrap-datepicker": "~1.4.0",
"floatThead": "^1.4.3",
"jstimezonedetect": "~1.0.5"
"floatThead": "^1.4.3"
}
}

View file

@ -51,7 +51,5 @@ module.exports = function(defaults) {
]
});
app.import('bower_components/jstimezonedetect/jstz.js');
return app.toTree(trees);
};

View file

@ -5,7 +5,6 @@ import pageParticipation from 'croodle/tests/pages/poll/participation';
import pageEvaluation from 'croodle/tests/pages/poll/evaluation';
import moment from 'moment';
/* jshint proto: true */
/* global jstz */
const { run } = Ember;
@ -63,7 +62,7 @@ test('view a poll with dates', function(assert) {
test('view a poll with dates and times', function(assert) {
let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
let timezone = jstz.determine().name();
let timezone = moment.tz.guess();
let poll = server.create('poll', {
encryptionKey,
isDateTime: true,
@ -92,7 +91,7 @@ test('view a poll with dates and times', function(assert) {
test('view a poll while timezone differs from the one poll got created in and choose local timezone', function(assert) {
let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
let timezoneUser = jstz.determine().name();
let timezoneUser = moment.tz.guess();
let timezonePoll = timezoneUser !== 'America/Caracas' ? 'America/Caracas' : 'Europe/Moscow';
let poll = server.create('poll', {
encryptionKey,
@ -164,7 +163,7 @@ test('view a poll while timezone differs from the one poll got created in and ch
test('view a poll while timezone differs from the one poll got created in and choose poll timezone', function(assert) {
let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
let timezoneUser = jstz.determine().name();
let timezoneUser = moment.tz.guess();
let timezonePoll = timezoneUser !== 'America/Caracas' ? 'America/Caracas' : 'Europe/Moscow';
let poll = server.create('poll', {
encryptionKey,