Skip to content

Commit

Permalink
v14.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mceachen committed May 14, 2021
1 parent 5c36d41 commit 3b989a1
Show file tree
Hide file tree
Showing 7 changed files with 269 additions and 234 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ vendored versions of ExifTool match the version they vendor.

## Version history

### v14.4.0

- ✨ Added `ExifDate.rawValue`
- 📦 Updated dependencies

### v14.3.0 🔥

- 🔥/🌱 ExifTool upgraded to [v12.25](https://exiftool.org/history.html#v12.25).
Expand Down
2 changes: 1 addition & 1 deletion docs/assets/js/search.js

Large diffs are not rendered by default.

29 changes: 23 additions & 6 deletions docs/classes/exifdate.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ <h3>Properties</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-property tsd-parent-kind-class"><a href="exifdate.html#day" class="tsd-kind-icon">day</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="exifdate.html#month" class="tsd-kind-icon">month</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="exifdate.html#rawvalue" class="tsd-kind-icon">raw<wbr>Value</a></li>
<li class="tsd-kind-property tsd-parent-kind-class"><a href="exifdate.html#year" class="tsd-kind-icon">year</a></li>
</ul>
</section>
Expand All @@ -121,7 +122,7 @@ <h2>Constructors</h2>
<a name="constructor" class="tsd-anchor"></a>
<h3>constructor</h3>
<ul class="tsd-signatures tsd-kind-constructor tsd-parent-kind-class">
<li class="tsd-signature tsd-kind-icon">new <wbr>Exif<wbr>Date<span class="tsd-signature-symbol">(</span>year<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, month<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, day<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="exifdate.html" class="tsd-signature-type" data-tsd-kind="Class">ExifDate</a></li>
<li class="tsd-signature tsd-kind-icon">new <wbr>Exif<wbr>Date<span class="tsd-signature-symbol">(</span>year<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, month<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, day<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">number</span>, rawValue<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="exifdate.html" class="tsd-signature-type" data-tsd-kind="Class">ExifDate</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
Expand All @@ -141,6 +142,9 @@ <h5>month: <span class="tsd-signature-type">number</span></h5>
<li>
<h5>day: <span class="tsd-signature-type">number</span></h5>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> rawValue: <span class="tsd-signature-type">string</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="exifdate.html" class="tsd-signature-type" data-tsd-kind="Class">ExifDate</a></h4>
</li>
Expand All @@ -163,6 +167,13 @@ <h3><span class="tsd-flag ts-flagReadonly">Readonly</span> month</h3>
<aside class="tsd-sources">
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="rawvalue" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagOptional">Optional</span> <span class="tsd-flag ts-flagReadonly">Readonly</span> raw<wbr>Value</h3>
<div class="tsd-signature tsd-kind-icon">raw<wbr>Value<span class="tsd-signature-symbol">:</span> <span class="tsd-signature-type">string</span></div>
<aside class="tsd-sources">
</aside>
</section>
<section class="tsd-panel tsd-member tsd-kind-property tsd-parent-kind-class">
<a name="year" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagReadonly">Readonly</span> year</h3>
Expand All @@ -183,7 +194,7 @@ <h3>to<wbr>Date</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/photostructure/exiftool-vendored.js/blob/main/src/ExifDate.ts#L56">src/ExifDate.ts:56</a></li>
<li>Defined in <a href="https://github.com/photostructure/exiftool-vendored.js/blob/main/src/ExifDate.ts#L57">src/ExifDate.ts:57</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Date</span></h4>
Expand All @@ -200,7 +211,7 @@ <h3>to<wbr>Exif<wbr>String</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/photostructure/exiftool-vendored.js/blob/main/src/ExifDate.ts#L64">src/ExifDate.ts:64</a></li>
<li>Defined in <a href="https://github.com/photostructure/exiftool-vendored.js/blob/main/src/ExifDate.ts#L65">src/ExifDate.ts:65</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
Expand All @@ -217,7 +228,7 @@ <h3>toISOString</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/photostructure/exiftool-vendored.js/blob/main/src/ExifDate.ts#L60">src/ExifDate.ts:60</a></li>
<li>Defined in <a href="https://github.com/photostructure/exiftool-vendored.js/blob/main/src/ExifDate.ts#L61">src/ExifDate.ts:61</a></li>
</ul>
</aside>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</span></h4>
Expand All @@ -234,7 +245,7 @@ <h3>to<wbr>String</h3>
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/photostructure/exiftool-vendored.js/blob/main/src/ExifDate.ts#L68">src/ExifDate.ts:68</a></li>
<li>Defined in <a href="https://github.com/photostructure/exiftool-vendored.js/blob/main/src/ExifDate.ts#L69">src/ExifDate.ts:69</a></li>
</ul>
</aside>
<h4 class="tsd-parameters-title">Parameters</h4>
Expand All @@ -251,7 +262,7 @@ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">string</s
<a name="fromdatetime" class="tsd-anchor"></a>
<h3><span class="tsd-flag ts-flagStatic">Static</span> from<wbr>Date<wbr>Time</h3>
<ul class="tsd-signatures tsd-kind-method tsd-parent-kind-class tsd-is-static">
<li class="tsd-signature tsd-kind-icon">from<wbr>Date<wbr>Time<span class="tsd-signature-symbol">(</span>dt<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">DateTime</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Maybe</span><span class="tsd-signature-symbol">&lt;</span><a href="exifdate.html" class="tsd-signature-type" data-tsd-kind="Class">ExifDate</a><span class="tsd-signature-symbol">&gt;</span></li>
<li class="tsd-signature tsd-kind-icon">from<wbr>Date<wbr>Time<span class="tsd-signature-symbol">(</span>dt<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">DateTime</span>, rawValue<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">string</span><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">Maybe</span><span class="tsd-signature-symbol">&lt;</span><a href="exifdate.html" class="tsd-signature-type" data-tsd-kind="Class">ExifDate</a><span class="tsd-signature-symbol">&gt;</span></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
Expand All @@ -265,6 +276,9 @@ <h4 class="tsd-parameters-title">Parameters</h4>
<li>
<h5>dt: <span class="tsd-signature-type">DateTime</span></h5>
</li>
<li>
<h5><span class="tsd-flag ts-flagOptional">Optional</span> rawValue: <span class="tsd-signature-type">string</span></h5>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Maybe</span><span class="tsd-signature-symbol">&lt;</span><a href="exifdate.html" class="tsd-signature-type" data-tsd-kind="Class">ExifDate</a><span class="tsd-signature-symbol">&gt;</span></h4>
</li>
Expand Down Expand Up @@ -388,6 +402,9 @@ <h4 class="tsd-returns-title">Returns <span class="tsd-signature-type">Maybe</sp
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="exifdate.html#month" class="tsd-kind-icon">month</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="exifdate.html#rawvalue" class="tsd-kind-icon">raw<wbr>Value</a>
</li>
<li class=" tsd-kind-property tsd-parent-kind-class">
<a href="exifdate.html#year" class="tsd-kind-icon">year</a>
</li>
Expand Down
24 changes: 12 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,34 +68,34 @@
]
},
"devDependencies": {
"@types/chai": "^4.2.17",
"@types/chai-as-promised": "^7.1.3",
"@types/chai": "^4.2.18",
"@types/chai-as-promised": "^7.1.4",
"@types/chai-subset": "^1.3.3",
"@types/fs-extra": "^9.0.11",
"@types/globule": "^1.1.3",
"@types/he": "^1.1.1",
"@types/luxon": "^1.26.5",
"@types/mocha": "^8.2.2",
"@types/node": "^15.0.1",
"@types/node": "^15.0.3",
"@types/progress": "^2.0.3",
"@types/rimraf": "^3.0.0",
"@types/tar-fs": "^2.0.0",
"@types/tmp": "^0.2.0",
"@types/xmldom": "^0.1.30",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"@typescript-eslint/eslint-plugin": "^4.23.0",
"@typescript-eslint/parser": "^4.23.0",
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
"chai-subset": "^1.6.0",
"eslint": "^7.25.0",
"eslint-plugin-import": "^2.22.1",
"eslint": "^7.26.0",
"eslint-plugin-import": "^2.23.0",
"eslint-plugin-node": "^11.1.0",
"extract-zip": "^2.0.1",
"fs-extra": "^9.1.0",
"fs-extra": "^10.0.0",
"globule": "^1.3.2",
"mocha": "^8.3.2",
"mocha": "^8.4.0",
"npm-run-all": "^4.1.5",
"prettier": "^2.2.1",
"prettier": "^2.3.0",
"progress": "^2.0.3",
"rimraf": "^3.0.2",
"serve": "^11.3.2",
Expand All @@ -108,9 +108,9 @@
"xpath": "^0.0.32"
},
"dependencies": {
"batch-cluster": "^6.0.2",
"batch-cluster": "^6.1.0",
"he": "^1.2.0",
"luxon": "^1.26.0",
"luxon": "^1.27.0",
"tz-lookup": "^6.1.25"
},
"optionalDependencies": {
Expand Down
6 changes: 4 additions & 2 deletions src/ExifDate.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { expect } from "./_chai.spec"
import { ExifDate } from "./ExifDate"

describe("ExifDateTime", () => {
describe("ExifDate", () => {
for (const { text, iso } of [
{ text: "2018:9:3", iso: "2018-09-03" },
{ text: "2018:02:09", iso: "2018-02-09" },
Expand All @@ -11,7 +11,9 @@ describe("ExifDateTime", () => {
{ text: "April 09 2018", iso: "2018-04-09" },
]) {
it("parses " + iso, () => {
expect(ExifDate.fromEXIF(text)?.toISOString()).to.eql(iso)
const ed = ExifDate.fromEXIF(text)
expect(ed?.toISOString()).to.eql(iso)
expect(ed?.rawValue).to.eql(text)
})
}
for (const ea of ["", " ", "0000", "1958", "2010_08"]) {
Expand Down
11 changes: 6 additions & 5 deletions src/ExifDate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import { blank, pad2, toS } from "./String"
*/
export class ExifDate {
static fromISO(text: string): Maybe<ExifDate> {
return this.fromDateTime(DateTime.fromISO(text))
return this.fromDateTime(DateTime.fromISO(text), text)
}

private static fromPatterns(text: string, fmts: string[]) {
if (blank(text)) return
text = toS(text).trim()
return first(fmts, (fmt) =>
map(DateTime.fromFormat(text, fmt), (dt) => this.fromDateTime(dt))
map(DateTime.fromFormat(text, fmt), (dt) => this.fromDateTime(dt, text))
)
}

Expand All @@ -41,16 +41,17 @@ export class ExifDate {
])
}

static fromDateTime(dt: DateTime): Maybe<ExifDate> {
static fromDateTime(dt: DateTime, rawValue?: string): Maybe<ExifDate> {
return validDateTime(dt)
? new ExifDate(dt.year, dt.month, dt.day)
? new ExifDate(dt.year, dt.month, dt.day, rawValue)
: undefined
}

constructor(
readonly year: number, // full year (probably 2019-ish, but maybe Japanese 30-ish). See https://ericasadun.com/2018/12/25/iso-8601-yyyy-yyyy-and-why-your-year-may-be-wrong/
readonly month: number, // 1-12, (no crazy 0-11 nonsense from Date!)
readonly day: number // 1-31
readonly day: number, // 1-31
readonly rawValue?: string
) {}

toDate(): Date {
Expand Down
Loading

0 comments on commit 3b989a1

Please sign in to comment.