Time zone setting affects image metadata displayed

Not sure if it's a bug or a weird choice of behaviour...

I've gallery of photos taken in different timezones, metadata for each image lists correct date, time and timezone (and can be viewed in Zenphoto admin too).
But, metadata field "Date taken" displayed for each image is altered to the current Time Zone, as set via General->Time zone setting or, if not specified, to server time.

I believe this is not a useful behaviour for this scenario (displaying photo metadata), as it can confuse visitors especially when dealing with photos taken in vastly different time zone - you can get a night photo with listed time taken at noon.

Comments

  • acrylian Administrator, Developer
    edited December 2023

    If you have "localized dates" enabled that could probably be the expected behaviour. Try if disabling makes a difference.

  • I'm not using "localized dates", tried to enable it to check - it just changes formatting, but not the addition of time-zone.

  • acrylian Administrator, Developer

    No it does not change "formatting" it translates/localizes dates, especially the day and month names and also does some conversion based on the locale and time zone.

    Besides everything uses the time zone as defined on the option and of course dates are displayed based on that. Including meta dates.

    That "localized" stuff is rather complicated in PHP 8+ now which is why it was not even correct in 1.6.

    Perhaps we can look into this for 1.6.2 later if it is not too complicated but probably we will need some test images with dates with different time zones.

  • It all boils down to function zpFormattedDate which is used for everything and adds time zone, but probably shouldn't be used for image metadata.

    I've got a few for you to test with:

    https://www.photo.private-universe.net/travel/uk/london/st-pauls-cathedral.jpg.html
    taken at 28.08.2013 21.17 London time, date shown is August 29, 2013 0:17

    https://www.photo.private-universe.net/travel/russia/vladivostok/rusalka.jpg.html
    taken at 14.05.2009 13.30 Vladivostok time, date shown is May 14, 2009 7:30

    Currently my time zone setting is Europe/Moscow (+3 hours)
    and I can test with server time America/Los_Angeles (-10 hours)

  • acrylian Administrator, Developer

    It all boils down to function zpFormattedDate which is used for everything and adds time zone, but probably shouldn't be used for image metadata.

    Ok, I think I get what you mean now. We'll take a look. Probably it could be an option or a parameter for printImageMetadata() to choose.

  • acrylian Administrator, Developer
    edited January 26

    I finally have taken a look at this:

    I did test your St. Paul image above: ExifDateTimeOriginal 2013-08-28T21:17:16+01:00 is displayed as:

    • Original Time Taken: 28.8.2013 22:17:16

    including the other dates:

    • Time Digitized: 28.8.2013 21:17:16
    • Date Created: 28.8.2013 24:00:00
    • Time Created: 26.1.2024 21:17:16
    • Digital Creation Date: 28.8.2013 24:00:00
    • Digital Creation Time: 26.1.2024 21:17:16

    The behaviour is technically correct as all PHP date functions either use the defined server timezone if no timezone is specified in the date itself (results in the "unconverted" date) or the specified timezone. It is not our function doing this but the date itself technically

    I can just remove the timezone parts from the string to get the plain "unconverted" date. Shouldn't we at least append the offset like 28.8.2013 22:17:16 (+01:00) to indicate another timezone?

    I am not sure if this should default option to the metadata options like "Ignore timezone in metadata dates" or similar.

  • I think that image metadata should be displayed as-is, unconverted by default.

    Adjusting date-time elsewhere on the website is absolutely necessary, but image metadata often already has timezones specified either in-camera or afterwards (I believe offset in test image is an indication of summer time adjustment).

  • acrylian Administrator, Developer

    Yes, probably you are right regarding the conversion.

  • acrylian Administrator, Developer

    I finally committed something to 1.6.2a using your images for testing. Please take a look.

  • kuzzzma Member
    edited February 11

    I've tested it and works great!
    Metadata for photos shows the real time taken.

    Note to others: I had to update my theme functions file too, as it used old code for some display modifications, so if it's not working for you - you might want to check what function your image page template uses (standard printImageMetadata or something else)

  • acrylian Administrator, Developer

    Thanks for the feedback. Yes, the change only applies to the standard printImageMetadata() printing the meta data table.

Sign In or Register to comment.