Skip to content

Commit

Permalink
improvement: set activeTimezone when transforming dates
Browse files Browse the repository at this point in the history
no issue
  • Loading branch information
kirrg001 committed Jul 26, 2016
1 parent c9dc367 commit dde8231
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Expand Up @@ -186,6 +186,13 @@ module.exports = function transformDatesIntoUTC(options, logger) {
});
});
},
function setActiveTimezone() {
var timezone = config.forceTimezoneOnMigration || moment.tz.guess();
return models.Settings.edit({
key: 'activeTimezone',
value: timezone
}, options);
},
function addMigrationSettingsEntry() {
settingsMigrations[settingsKey] = moment().format();
return models.Settings.edit({
Expand Down
9 changes: 1 addition & 8 deletions core/test/unit/migration_fixture_spec.js
Expand Up @@ -1018,6 +1018,7 @@ describe('Fixtures', function () {
serverTimezoneOffset = -60;
migrationsSettingsValue = '{}';

// stub for checkIfMigrationAlreadyRan
sandbox.stub(models.Settings.prototype, 'fetch', function () {
// CASE: we update migrations settings entry
if (this.get('key') === 'migrations') {
Expand All @@ -1028,14 +1029,6 @@ describe('Fixtures', function () {
return Promise.resolve(newModels[Number(this.get('key'))]);
});

sandbox.stub(models.Base.Model.prototype, 'save', function (data) {
if (data.key !== 'migrations') {
should.exist(data.created_at);
}

return Promise.resolve({});
});

_.each(['Post', 'User', 'Subscriber', 'Settings', 'Role', 'Permission', 'Tag', 'App', 'AppSetting', 'AppField', 'Client'], function (modelType) {
sandbox.stub(models[modelType], 'findAll', function () {
var model = models[modelType].forge();
Expand Down

0 comments on commit dde8231

Please sign in to comment.