diff --git a/CHANGELOG.md b/CHANGELOG.md index 000fb4c5..ff7c25d0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -26,9 +26,14 @@ vendored versions of ExifTool match the version that they vendor. ## Version history +### v23.3.0 + +- 🐞 Restored datestamp parsing of `ResourceEvent.When` + ### v23.2.0 - ✨ Timezone parsing improvements: + - Added [`ExifToolOptions.inferTimezoneFromDatestampTags`](https://photostructure.github.io/exiftool-vendored.js/interfaces/ExifToolOptions.html#inferTimezoneFromDatestampTags). - Timezone inference from datestamps now skips over UTC values, as Google Takeout (and several other applications) may spuriously set "+00:00" to diff --git a/src/ReadTask.spec.ts b/src/ReadTask.spec.ts index f3d16ba8..e012444a 100644 --- a/src/ReadTask.spec.ts +++ b/src/ReadTask.spec.ts @@ -1131,6 +1131,26 @@ describe("ReadTask", () => { }) }) + it("Resource.When is parsed by ExifDateTime", () => { + const t = parse({ + tags: { + History: [ + { + Action: "infer", + Changed: "Make", + Parameters: '"ppeggj"', + SoftwareAgent: "PhotoStructure", + When: "2023:10:01 17:13:07.141", + }, + ], + }, + }) + expect(t.History).to.be.an("array") + const w = (t.History as any)[0].When + expect(w).to.be.instanceof(ExifDateTime) + expect(w.toString()).to.eql("2023-10-01T17:13:07.141") + }) + describe("SubSecDateTimeOriginal", () => { it("extracts datetimestamp with millis", () => { const t = parse({ diff --git a/src/ReadTask.ts b/src/ReadTask.ts index e4ac0449..5e086789 100644 --- a/src/ReadTask.ts +++ b/src/ReadTask.ts @@ -285,7 +285,7 @@ export class ReadTask extends ExifToolTask { if (typeof value === "object") { const result: any = {} for (const [k, v] of Object.entries(value)) { - result[k] = this.#parseTag(k, v) + result[k] = this.#parseTag(tagName + "." + k, v) } return result } @@ -312,12 +312,17 @@ export class ReadTask extends ExifToolTask { // Time-only tags have "time" but not "date" in their name: const keyIncludesTime = /time/i.test(tagName) const keyIncludesDate = /date/i.test(tagName) + const keyIncludesWhen = /when/i.test(tagName) // < ResourceEvent.When const result = - (keyIncludesTime || keyIncludesDate + (keyIncludesTime || keyIncludesDate || keyIncludesWhen ? ExifDateTime.from(value, tz) : undefined) ?? - (keyIncludesTime ? ExifTime.fromEXIF(value) : undefined) ?? - (keyIncludesDate ? ExifDate.from(value) : undefined) ?? + (keyIncludesTime || keyIncludesWhen + ? ExifTime.fromEXIF(value) + : undefined) ?? + (keyIncludesDate || keyIncludesWhen + ? ExifDate.from(value) + : undefined) ?? value if ( this.options.backfillTimezones &&