parent
70ba444b39
commit
ee6728314a
5 changed files with 6 additions and 12 deletions
|
@ -4,7 +4,6 @@ import {
|
||||||
}
|
}
|
||||||
from 'ember-cp-validations';
|
from 'ember-cp-validations';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
/* global jstz */
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
computed,
|
computed,
|
||||||
|
@ -55,7 +54,7 @@ export default Controller.extend(Validations, {
|
||||||
return !moment(option.get('title'), 'YYYY-MM-DD', true).isValid();
|
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
|
// save poll
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
import Ember from 'ember';
|
import Ember from 'ember';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
/* global jstz */
|
|
||||||
|
|
||||||
const {
|
const {
|
||||||
computed,
|
computed,
|
||||||
|
@ -84,7 +83,7 @@ export default Controller.extend({
|
||||||
*/
|
*/
|
||||||
timezoneDiffers: computed('model.timezone', function() {
|
timezoneDiffers: computed('model.timezone', function() {
|
||||||
const modelTimezone = this.get('model.timezone');
|
const modelTimezone = this.get('model.timezone');
|
||||||
return isPresent(modelTimezone) && jstz.determine().name() !== modelTimezone;
|
return isPresent(modelTimezone) && moment.tz.guess() !== modelTimezone;
|
||||||
}),
|
}),
|
||||||
|
|
||||||
useLocalTimezone: false,
|
useLocalTimezone: false,
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
"sjcl": "~1.0.6",
|
"sjcl": "~1.0.6",
|
||||||
"bootstrap": "~3.3.5",
|
"bootstrap": "~3.3.5",
|
||||||
"bootstrap-datepicker": "~1.4.0",
|
"bootstrap-datepicker": "~1.4.0",
|
||||||
"floatThead": "^1.4.3",
|
"floatThead": "^1.4.3"
|
||||||
"jstimezonedetect": "~1.0.5"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,5 @@ module.exports = function(defaults) {
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|
||||||
app.import('bower_components/jstimezonedetect/jstz.js');
|
|
||||||
|
|
||||||
return app.toTree(trees);
|
return app.toTree(trees);
|
||||||
};
|
};
|
||||||
|
|
|
@ -5,7 +5,6 @@ import pageParticipation from 'croodle/tests/pages/poll/participation';
|
||||||
import pageEvaluation from 'croodle/tests/pages/poll/evaluation';
|
import pageEvaluation from 'croodle/tests/pages/poll/evaluation';
|
||||||
import moment from 'moment';
|
import moment from 'moment';
|
||||||
/* jshint proto: true */
|
/* jshint proto: true */
|
||||||
/* global jstz */
|
|
||||||
|
|
||||||
const { run } = Ember;
|
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) {
|
test('view a poll with dates and times', function(assert) {
|
||||||
let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||||
let timezone = jstz.determine().name();
|
let timezone = moment.tz.guess();
|
||||||
let poll = server.create('poll', {
|
let poll = server.create('poll', {
|
||||||
encryptionKey,
|
encryptionKey,
|
||||||
isDateTime: true,
|
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) {
|
test('view a poll while timezone differs from the one poll got created in and choose local timezone', function(assert) {
|
||||||
let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||||
let timezoneUser = jstz.determine().name();
|
let timezoneUser = moment.tz.guess();
|
||||||
let timezonePoll = timezoneUser !== 'America/Caracas' ? 'America/Caracas' : 'Europe/Moscow';
|
let timezonePoll = timezoneUser !== 'America/Caracas' ? 'America/Caracas' : 'Europe/Moscow';
|
||||||
let poll = server.create('poll', {
|
let poll = server.create('poll', {
|
||||||
encryptionKey,
|
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) {
|
test('view a poll while timezone differs from the one poll got created in and choose poll timezone', function(assert) {
|
||||||
let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
let encryptionKey = 'abcdefghijklmnopqrstuvwxyz0123456789';
|
||||||
let timezoneUser = jstz.determine().name();
|
let timezoneUser = moment.tz.guess();
|
||||||
let timezonePoll = timezoneUser !== 'America/Caracas' ? 'America/Caracas' : 'Europe/Moscow';
|
let timezonePoll = timezoneUser !== 'America/Caracas' ? 'America/Caracas' : 'Europe/Moscow';
|
||||||
let poll = server.create('poll', {
|
let poll = server.create('poll', {
|
||||||
encryptionKey,
|
encryptionKey,
|
||||||
|
|
Loading…
Reference in a new issue