Skip to content

Commit b0f0f07

Browse files
authored
Fix date metadata for filenames with extra chars (#176)
1 parent 7cd10e5 commit b0f0f07

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

.changeset/perfect-rockets-agree.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@tidaltheory/lens': patch
3+
---
4+
5+
Fix ModifyDate if filenames include characters after the timestamp

src/cli.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,9 @@ prog.command('jpg <src>')
238238
let sharpImage = sharp(source)
239239
spinner.text = 'Converting to JPG...'
240240

241+
// Remove any non-digit characters from the end of the filename.
242+
name = name.replace(/\D*$/, '')
243+
241244
let dt = name.slice(-14)
242245
let d = dt.slice(0, 8)
243246
let t = dt.slice(8)

0 commit comments

Comments
 (0)