Timezone setting doesn't work correctly when importing date only values?

Created on 9 July 2020, over 4 years ago
Updated 1 March 2023, about 2 years ago

I am importing a csv file and among the various fields there are fields with the Italian date (dd / mm / yyyy)
I set the date field as Italian and Timezone handling Europe / Rome
But I noticed that all dates that start with a day above 12 don't care because it keeps it in mind as a month and not as a day

I changed the csv and put the value of Italian Date as Data because I import it in the Title
and Data1 (data field) as dd / mm / yy, to get it imported, but I noticed a strange thing.
In the date field I put the format in Italian but less 1 day. Ex. 02/26/2020 stores it as 02/25/2020

I do not understand why.

Is there any other way to give the format to do the import well?

Thank you

๐Ÿ› Bug report
Status

Active

Component

Code

Created by

๐Ÿ‡ฎ๐Ÿ‡นItaly Gae58

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States chrisgross

    I am seeing this issue myself and changing the time zone to UTC in the feed config for the fields does not seem to work. I am in UTC -5 and have a JSON feed providing times in UTC. However, the date-only fields I am importing into end up with the wrong date if the times stamp is too close to midnight.

    For example, the feed provides "2023-05-16T03:45:00.000Z" and when I import it, the destination field is "2023-05-16". But being in UTC -5, I need this to be "2023-05-15". Changing the time zone field in the feed mapping does not seem to affect this at all. This might be partially due to the fact that core's default date field handling seems pretty bad, but is there no way to fix this? Do I have to process the feed items in a custom Event Subscriber to correct this?

  • ๐Ÿ‡บ๐Ÿ‡ธUnited States chrisgross
  • It may not be of use, I just want report that similar issue happens with the webform uploaded "created", "completed" and "altered" data in drupal 9. It goes back 1 day. Since It didn't had to be the exactly time I just adjusted it to 23:59:59 and the timezone (that I guess it's from US) pushed the date to next day, but it's a poor way of work around.

  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark jens peter

    I had this exact problem.
    I cannot understand why this is not sorted a long time ago, but guess the developers are from the USA so not important for them.

    I used #2: Feeds Tamper plugin โ€œFind Replace REGEXโ€
    It works as long as I set the time zone to UTC.

  • ๐Ÿ‡ณ๐Ÿ‡ฑNetherlands megachriz

    @jens peter

    I cannot understand why this is not sorted a long time ago

    Well, it is because I'm unable to address every issue. Feeds has more than 800 open issues and I also am maintainer of a few other projects on drupal.org. While I would like to get everything fixed, I can only do so much. ๐Ÿคทโ€โ™‚๏ธ

    but guess the developers are from the USA

    Nope, I'm from the Netherlands. ๐Ÿ™‚ I import date values too, but apparently I'm not affected by this issue. I think that it is PHP who assumes American date formats by default.

    If you like to get this issue addressed, you can help in the following way:

    • By providing an automated test that demonstrates the issue.
    • After that, by providing a fix that make that test pass.
    • By joining the weekly Feeds meeting on Slack and help with reviewing or testing other issues that are being discussed during that meeting. The meeting is every Thursday on 19:00 UTC from November till March and 18:00 UTC from April till October.
  • ๐Ÿ‡ฉ๐Ÿ‡ฐDenmark jens peter

    @megachriz

    Thank you. I fully understand how much work there must be in maintaining a module as this one.
    I got the feeling that many have the same problem when they are located outside of the USA - maybe that is not the case.
    If it is related to PHP it can be difficult to correct - I get that.

    But then a work around could be to make a tamper option that can correct this for the date field.
    It has been present for 5 years :-) but I understand it might not be easy.

    I am not in a position to help on this as I am a designer - I have used Drupal since version 5 and was the most happy when it was called 7 - since then it has gone down hill - from best to very technical and not a good tool for a designer anymore.

    I do appreciate your hard work on this module - I see you also have worked on many other parts I have used over the years.
    Thank you.

Production build 0.71.5 2024