devongovett / exif-reader

A small EXIF image metadata reader
MIT License
152 stars 22 forks source link

Use UTC time for date objects #4

Closed blakeembrey closed 8 years ago

blakeembrey commented 8 years ago

Closes https://github.com/devongovett/exif-reader/issues/3.

For reference, it's currently impossible to re-use the output for test fixtures as the tests may be run in a different timezone (E.g. Travis: https://travis-ci.org/blakeembrey/node-scrappy/builds/144605673).

blakeembrey commented 8 years ago

If this isn't possible because EXIF is meant to be local to where the photo was taken, can we enable a flag that'll avoid parsing it instead? That would at least be backward compatible. I just need dates that are consistent.

devongovett commented 8 years ago

Yeah I think exif dates are supposed to be in the timezone where the image was taken... But either way we are parsing it in the timezone where the image is being loaded.

There is the TimeZoneOffset tag, but not sure it is used much in the real world. We could try looking for that, and if it is not found, default to UTC?

blakeembrey commented 8 years ago

I haven't seen it used in anything I've looked at, more common would be the GPS coordinates (https://apple.stackexchange.com/questions/50001/iphone-exif-gps-timestamp-appears-to-be-based-on-local-settings). That said, maybe it's easier to split this functionality apart so that future changes aren't breaking changes? You could expose a helper function (or a module) for doing this - converting the exif dates to a date object.

devongovett commented 8 years ago

OK, just going to merge this for now.