Skip to content

Commit

Permalink
defaultVideosToUTC/backfillTimezones improvements
Browse files Browse the repository at this point in the history
- if backfillTimezones=false, no timezone defaults are used unless the file is a video and defaultVideosToUTC=true
- backfillTimezones now defaults to true
- use new ExifDateTime.inferredZone to determine when to backfill zones
- avoid File stat tags (which use SystemZone) as a candidate EDT for zone adoption
- if defaultVideosToUTC=true, Tags.tz isn't forced to UTC anymore if we can extract a reasonable zone, but we still parse all datestamps with a UTC default backstop
  • Loading branch information
mceachen committed Sep 13, 2023
1 parent b98e193 commit fbabbce
Show file tree
Hide file tree
Showing 5 changed files with 379 additions and 228 deletions.
24 changes: 24 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,30 @@ vendored versions of ExifTool match the version that they vendor.

## Version history

### v23.0.0

- 🏚️ Dropped support for Node.js v16, which is [End-of-Life](https://nodejs.org/en/blog/announcements/nodejs16-eol).

- 💔/🐞 If `defaultVideosToUTC` is set to `true`, `read()` will now allow non-UTC
timezones extractable from other tags to be assigned to `.tz`. Prior
versions would simply force `.tz` to "UTC" for all videos, which wasn't
great. Note that "UTC" is still used as the default timezone for all
datestamps without explicit timezones, just as prior versions did. See [issue
#156](https://github.com/photostructure/exiftool-vendored.js/issues/156) for
details.

- 💔 `backfillTimezones` now defaults to `true`. Although this is likely to be
what people expect, know that there are edge and corner cases that you
should be aware of.

- 💔 If `backfillTimezones` is set to `false`, `ExifDateTime` will no longer
use the current file's `.tz` as a default. Prior versions would inherit the
file's `.tz`, which might be incorrect.

- 📦 `ExifDateTime` now includes an `.inferredZone` field, which may be useful
in helping to determine how "trustworthy" the zone and actual datestamp
value is.

### v22.2.3

- 🐞 Apply the v22.2.3 bugfix _even wider_ (just found a `SubSecTime` value of "01" in the wild, and it was happily parsed into today's date, oops).
Expand Down
2 changes: 1 addition & 1 deletion src/DefaultExifToolOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export const DefaultExifToolOptions: Omit<
includeImageDataMD5: undefined,
imageHashType: false,
defaultVideosToUTC: true,
backfillTimezones: false, // to retain prior behavior
backfillTimezones: true,
inferTimezoneFromDatestamps: false, // to retain prior behavior
geoTz: geoTz,
isIgnorableError: isIgnorableWarning,
Expand Down
11 changes: 9 additions & 2 deletions src/ExifToolOptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,13 @@ export interface ExifToolOptions
* If set to `true`, and `defaultVideosToUTC` is also `true`, we'll try
* backfilling timezones for date-times that are UTC, as well.
*
* This defaults to false to retain prior versions' behavior.
* Setting this to `false` removes **all** timezone inference--only those
* date-times with an explicit offset will have a defined timezone. Prior
* versions of exiftool-vendored would use the file's `.tz` as a backstop
* even if this was set to `false`.
*
* As of version 23, this now defaults to `true`, as it's more likely to be
* what people expect.
*/
backfillTimezones: boolean

Expand All @@ -140,7 +146,8 @@ export interface ExifToolOptions
* datestamp whose tag starts with "Creat" and includes an offset? (This
* means CreateDateSubSec, CreateDate, and CreationDate will be considered).
*
* This defaults to false to retain prior versions' behavior.
* This defaults to false as it both retains prior behavior and means fewer
* "fuzzy" heuristics are enabled by default.
*/
inferTimezoneFromDatestamps: boolean

Expand Down
Loading

0 comments on commit fbabbce

Please sign in to comment.