diff -u b/core/modules/migrate/src/Plugin/migrate/process/FormatDate.php b/core/modules/migrate/src/Plugin/migrate/process/FormatDate.php --- b/core/modules/migrate/src/Plugin/migrate/process/FormatDate.php +++ b/core/modules/migrate/src/Plugin/migrate/process/FormatDate.php @@ -15,7 +15,8 @@ * - from_format: The source format string as accepted by * @link http://php.net/manual/datetime.createfromformat.php \DateTime::createFromFormat. @endlink * - to_format: The destination format. - * - timezone: String identifying the required source time zone, see + * - timezone: String identifying the required time zone, see + * - from_timezone: String identifying the required source time zone, see * DateTimePlus::__construct(). * - to_timezone: String identifying the required destination time zone, see * DateTimePlus::__construct(). @@ -56,7 +57,7 @@ * plugin: format_date * from_format: 'Y-m-d\TH:i:sO' * to_format: 'Y-m-d\TH:i:s' - * timezone: 'America/Managua' + * from_timezone: 'America/Managua' * to_timezone: 'UTC' * settings: * validate_format: false @@ -94,8 +95,9 @@ $fromFormat = $this->configuration['from_format']; $toFormat = $this->configuration['to_format']; - $from_timezone = isset($this->configuration['timezone']) ? $this->configuration['timezone'] : NULL; - $to_timezone = isset($this->configuration['to_timezone']) ? $this->configuration['to_timezone'] : $from_timezone; + $timezone = isset($this->configuration['timezone']) ? $this->configuration['timezone'] : NULL; + $from_timezone = isset($this->configuration['from_timezone']) ? $this->configuration['from_timezone'] : $timezone; + $to_timezone = isset($this->configuration['to_timezone']) ? $this->configuration['to_timezone'] : NULL; $settings = isset($this->configuration['settings']) ? $this->configuration['settings'] : []; // Attempts to transform the supplied date using the defined input format. diff -u b/core/modules/migrate/tests/src/Unit/process/FormatDateTest.php b/core/modules/migrate/tests/src/Unit/process/FormatDateTest.php --- b/core/modules/migrate/tests/src/Unit/process/FormatDateTest.php +++ b/core/modules/migrate/tests/src/Unit/process/FormatDateTest.php @@ -111,9 +111,18 @@ ], 'timezone' => [ 'configuration' => [ + 'from_format' => 'Y-m-d\TH:i:sO', + 'to_format' => 'Y-m-d\TH:i:s', + 'timezone' => 'America/Managua', + ], + 'value' => '2004-12-19T10:19:42-0600', + 'expected' => '2004-12-19T10:19:42', + ], + 'timezone_from_to' => [ + 'configuration' => [ 'from_format' => 'Y-m-d h:i:s', 'to_format' => 'Y-m-d h:i:s', - 'timezone' => 'America/Managua', + 'from_timezone' => 'America/Managua', 'to_timezone' => 'UTC', ], 'value' => '2004-12-19 10:19:42',