-
Notifications
You must be signed in to change notification settings - Fork 70
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DateTime not accurate (offset by n hours) #90
Comments
Looks like a bug here: exifr/src/dicts/tiff-revivers.mjs Lines 48 to 62 in 6cbf6e9
Should be using |
I'm also experiencing this date inaccuracy, with RAW files based on TIFF. Here is what DateTimeOriginal: 2022-07-03T20:58:33.000Z, // inaccurate. This time is local, but Z indicates UTC. This should be 2022-07-04T02:58:33.000Z when using UTC.
CreateDate: 2022-07-03T20:58:33.000Z, // inaccurate. This time is local, but Z indicates UTC. This should be 2022-07-04T02:58:33.000Z when using UTC.
OffsetTime: '-06:00', // accurate For comparison, Date Time Original: 2022:07:03 20:58:33-06:00
Create Date: 2022:07:03 20:58:33-06:00
Offset Time: -06:00 |
The fix may be to adjust the local time by the offset after creating the date object, by adding something like below after Line 57 in the tiff reviver and passing the offset into the const date = new Date(dateTimeOriginal);
// Convert from string (e.g. -06:00) to number (e.g. -360)
const offsetMin = Number(offsetString.split(':')[0]) * 60;
// Change local time to UTC
date.setMinutes(date.getMinutes() - offsetMin); In my experience, if (!isUTC) { // pseudocode
// Convert from string (e.g. -06:00) to number (e.g. -360)
const offsetMin = Number(offsetString.split(':')[0]) * 60;
// Change local time to UTC
date.setMinutes(date.getMinutes() - offsetMin);
} |
@MikeKovarik I'd like to help solve this if you could guide how to get the datetime offset into the tiff river file please, because that seems to be the missing piece that would allow this code to be updated to convert the date object from local time to the correct UTC time. |
I noticed that the datetimes exifr provides are offset by some number of hours from the correct time. The times provided by exifr are two hours before the local time where the photos were taken. Perhaps this is related to the fact that the time zone of the system I'm using to read the data is currently two hours ahead of GMT.
Here is the relevant data from a photo read by exifr:
And with exif-reader (these are the correct local times):
The text was updated successfully, but these errors were encountered: