Problem/Motivation

This is a follow-up to #3196428: Migrate from standard date field in Drupal 7 to Recurring Events, where migration plugins were introduced.
I think the timezone adjustments are not quite correct, and here is why.

Let's take a look into this example:

$start_event = new DrupalDateTime($first['value'], DateTimeItemInterface::STORAGE_TIMEZONE);
$start_event->setTimezone($source_timezone);

In the first line we pass a date and clarify it's in UTC timezone, which is already not the case. The destination plugin accepts a dedicated setting with source timezone, which should be used here.

In the second line, it's not just changing the timezone, it's also updating the date accordingly. For example, if source timezone is America/Los_Angeles, it'll make -7 hours.

Proposed resolution

I'm not 100% sure, but the following steps seem more reasonable:
1) Clarify that source date is in America/Los_Angeles timezone;
2) Adjust the date to UTC before saving it into the database;

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

Matroskeen created an issue. See original summary.

matroskeen’s picture

Title: Timezone is not properly handled in migrate destination plugin » Timezone is not properly handled in migrate source plugin
matroskeen’s picture

Title: Timezone is not properly handled in migrate source plugin » Timezone is not properly handled in migrate process plugin
matroskeen’s picture

Status: Active » Needs review
owenbush’s picture

Thanks for the issue and the MR, I will try and review it as soon as possible.

  • owenbush committed 08c872b on 2.0.x authored by Matroskeen
    Issue #3309652 by Matroskeen, owenbush: Timezone is not properly handled...

  • owenbush committed 6d0546c on 8.x-1.x authored by Matroskeen
    Issue #3309652 by Matroskeen, owenbush: Timezone is not properly handled...
owenbush’s picture

Status: Needs review » Fixed

Thank you for the patch, this has been merged into 2.0.x and 8.x-1.x

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.