Fix tiff-reviver to adjust from local time to UTC#99
Conversation
|
I realized '2009-09-23 11:40:52-06:00' is a standard format so I can simply using the date object to parse it into UTC, when in this format. Updated the code. |
|
@websocket98765 I know this is over 1 year old and there is not much active going on with exifr. However @MikeKovarik seems to be active on github still. If Mike ever gets around to this PR, I would like to comment with another idea: I'm afraid that the problem lies with using the Date object in the first place. The Date object has bad support for timezones and alsways assumes the local timezone or UTC time. If you have two pictures, one in Sydney and one in London taken at the exact same time, their MS representation would be the same but the offset different. The Date object would simply show the two pictures taken at the exact same timestamp UTC or your local time. There is no option to show the time with their correct offsets. Therefore, my opinion / idea as that all dates should simply be returned as they are read from the exif sections. In string format if need be, or as a millisecond value and an offset. Then it would be up to the user of exifr to determine how to use the values in their code. |
|
@grasdk I agree with your points. To further the discussion, I've written a small library to handle this case. It performs the following functions:
The function returns:
With this information, photos can be correctly sorted regardless of where they were taken, and dates can be formatted locally or relative to any other time zone. Of course, your success will depend on what metadata is available with each photo. I've also added some normalization since The package is available here if you're curious. |
Goal is to fix this issue where Tiff-based formats revive an inaccurate date.