Problem/Motivation:

In 8.x-3.0-alpha3 (or earlier):

Feeds import will fail due to DateTimeZone::__construct(): Unknown or bad timezone (__SITE__) error, if you have selected 'Site default' in Timezone handling selection list for datetime or daterange field as default timezone.

In 8.x-3.x-dev

- datetime field: Import will fail due to DateTimeZone::__construct(): Unknown or bad timezone (__SITE__) error.
- daterange field: Import will fail due to DateTimeZone::__construct(): Unknown or bad timezone (__SITE__) error.
- datetime filed: Import will succeed, but default timezone (UTC) used instead of site default.

Proposed resolution:

It seems that 'Site default' option is not taken into account in convertToDate() function that prepares a date value.

Patch attached.

Comments

mitrpaka created an issue. See original summary.

megachriz’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

Thanks for catching this bug. It would be great if you could add an automated test that demonstrates the bug. This way we can prevent the bug from coming back.

Do you want to write a test for this, @mitrpaka?

mitrpaka’s picture

Issue summary: View changes
Status: Needs work » Needs review
StatusFileSize
new3.08 KB
new2.96 KB

Patch updated including simple test case to check timezone configuration.

  • MegaChriz committed d909174 on 8.x-3.x authored by mitrpaka
    Issue #3018729 by mitrpaka: Fixed 'Site default' timezone selection in...
megachriz’s picture

Status: Needs review » Fixed
Issue tags: -Needs tests

Thanks for writing the test!
I also tested manually if the bug got fixed. I changed the site timezone to "Sydney" and the user time zone to "Amsterdam". The date ""2018-07-29 06:50" got correctly imported in the "Sydney" timezone.

Committed #3.

Status: Fixed » Closed (fixed)

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