Skip to content

Commit d2fc939

Browse files
committed
Migrate display_timezone setting
Dates will be migrated into UTC, the app's timezone will remain as UTC, but the display_timezone will be set to the v2 app's timezone.
1 parent 1ddff5b commit d2fc939

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/SettingsMigrator.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ protected function migrateSystem()
124124

125125
Configurator::file($configFile = 'statamic/system.php')
126126
->set('multisite', count($sites) > 1)
127+
->set('display_timezone', $system['timezone'] ?? null)
127128
->ifNoChanges($this->throwNoChangesException($configFile));
128129

129130
return $this;

tests/MigrateSettingsTest.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,11 @@ public function it_migrates_routes()
155155
/** @test */
156156
public function it_migrates_system_settings()
157157
{
158+
$this->files->put($this->sitePath('settings/system.yaml'), <<<'EOT'
159+
timezone: 'America/New_York'
160+
EOT
161+
);
162+
158163
$this->artisan('statamic:migrate:settings', ['handle' => 'system']);
159164

160165
$this->assertSameWithNormalizedLineEndings(File::get(resource_path('sites.yaml')),
@@ -166,6 +171,11 @@ public function it_migrates_system_settings()
166171

167172
$this->assertConfigFileContains('system.php', <<<'EOT'
168173
'multisite' => false,
174+
EOT
175+
);
176+
177+
$this->assertConfigFileContains('system.php', <<<'EOT'
178+
'display_timezone' => 'America/New_York',
169179
EOT
170180
);
171181
}

0 commit comments

Comments
 (0)