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.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | interdiff-1-3.txt | 2.96 KB | mitrpaka |
| #3 | site-default-timezone-3018729-3.patch | 3.08 KB | mitrpaka |
| site-default-timezone.patch | 976 bytes | mitrpaka |
Comments
Comment #2
megachrizThanks 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?
Comment #3
mitrpaka commentedPatch updated including simple test case to check timezone configuration.
Comment #5
megachrizThanks 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.