Add local time zone export option for correct Apple Photos imports#15
Add local time zone export option for correct Apple Photos imports#15curtgrimes wants to merge 2 commits intoiamsanmith:mainfrom
Conversation
Add an option to export files with a DateTimeOriginal in UTC (default,
current behavior) or optionally in the system's local time zone. This
provides a workaround for an issue where files processed by this tool
and imported into Apple Photos may have incorrect dates/times due to
Apple Photos always assuming the DateTimeOriginal value (which does not
include an offset) is in the system's time zone. If the user knows they
will be importing their media into Apple Photos after processing it with
MetaSort, they can choose a new option to export files with a
DateTimeOriginal in the system's time zone instead of UTC.
A prompt and explanation of UTC vs. system time zone export is displayed
to the user. The default is the current behavior of exporting in UTC.
```
❓ Should timestamps be written in UTC (default) or using your current system time zone offset (-06:00)?
Timestamps get written to the DateTimeOriginal EXIF field. By design, this field does not
contain a time zone offset, only a date and time in the fixed YYYY:MM:DD HH:MM:SS format
(but other fields may contain an offset). Some apps like Apple Photos ignore the offset field
and interpret DateTimeOriginal in the local system's time zone offset. So if a photo
originally taken at "2024-05-05 15:00-05:00" is imported into Apple Photos with
a DateTimeOriginal converted to UTC "2024-05-05 20:00" (notice no time zone offset) on a
system set to a time zone offset of "-05:00", the Apple Photos interface will show that
the photo was taken at "2024-05-05 20:00-05:00" (8 pm in that time zone) instead of
"2024-05-05 15:00-05:00" (3 pm).
Writing the timestamp using the system's time zone offset instead of UTC prevents this shift
and preserves the correct displayed time, as long as you are importing into Apple Photos on
a system using this same time zone offset of -06:00.
How should timestamps be written?
1. UTC (default)
2. System time zone offset (-06:00) (recommended if importing into Apple Photos on a system set to this same offset)
1
✅ Timestamps will be written in UTC.
```
Or when selecting the new option:
```
2
✅ Timestamps will be written using the system time zone offset (-06:00).
```
1. Have a Google Photos export from Google Takeout
1. Or alternatively, create a folder with a minimal sample of a
Google Photos takeout:
1. Create a folder with a sample JPG named photo.jpg.
1. Give it the expected attribute:
```
exiftool -overwrite_original \
-DateTimeOriginal="2021:03:05 14:35:43" \
photo.jpg
```
1. In that folder, create a JSON file named photo.jpg.json with
this content:
```
{
"photoTakenTime": {
"timestamp": "1614976543",
"formatted": "Mar 5, 2021, 8:35:43 PM UTC"
}
}
```
1. Run that folder through MetaSort using the [How to Use MetaSort
instructions](https://github.com/iamsanmith/MetaSort#-how-to-use-metasort).
1. Import the photo into Apple Photos on macOS (drag it onto the Apple
Photos window).
1. Go to Apple Photos > Imports > Select the photo > Cmd + I.
1. Expected: The photo's time is 2:35:43 PM, which is what would have
been displayed in Google Photos
1. Actual: The photo's time is 8:35:43 PM.
|
Hi @curtgrimes, Yes - this feature is definitely required now. In recent versions of ExifTool, local time is no longer automatically written into That behavior has changed. Now, ExifTool writes the timestamp as-is, and many viewers (including Google Photos and other gallery apps) interpret and display the value strictly as UTC, even when epoch-based metadata is present. As a result, timestamps appear shifted unless local-time correction is explicitly applied. So going forward, MetaSort needs to manually apply the local-time offset while converting the epoch timestamp to an EXIF-formatted datetime. Example
Important additional requirementEven after the user selects a local timezone or the code determines a local time shift, MetaSort must first inspect the original media file for existing timezone metadata.
This prevents travel photos and mixed-timezone libraries from being unintentionally corrupted. This local-time correction logic is only required during epoch → timestamp conversion.
Please double-check that your commit follows this order of precedence:
Once done, feel free to email me at imsanmith@proton.me so I can verify and test it on my end. Thanks a lot for the effort and the contribution — really appreciated 🙏 |
|
Thank you for your response. Your comment feels like it was written completely by AI (if it was not, I apologize). It's unclear to me if the human @iamsanmith actually reviewed this code, and I don't feel compelled to put more time into this PR for your project because of it. But feel free to work it to completion on your end if you prefer. Thanks. |
|
@curtgrimes hey, yes i used ai to edit my message (to clean format it ) i personally reviewed your whole code so i asked for it |
When a photo in Google Photos with a date of "March 5, 2021 2:35 PM -06:00" is run through this tool and imported into Apple Photos, Apple Photos displays an incorrect date:
This adds an option that allows the photo to be imported into Apple Photos with a time that matches the time recorded in Google Photos:
Details
Add an option to export files with a DateTimeOriginal in UTC (default, current behavior) or optionally in the system's local time zone. This provides a workaround for an issue where files processed by this tool and imported into Apple Photos may have incorrect dates/times due to Apple Photos always assuming the DateTimeOriginal value (which does not include an offset) is in the system's time zone. If the user knows they will be importing their media into Apple Photos after processing it with MetaSort, they can choose a new option to export files with a DateTimeOriginal in the system's time zone instead of UTC.
A prompt and explanation of UTC vs. system time zone export is displayed to the user. The default is the current behavior of exporting in UTC.
Or when selecting the new option:
Steps to reproduce issue