From a180ab72645dcf97fcb6568fca8f8a249ae3210e Mon Sep 17 00:00:00 2001 From: Jeff Date: Sun, 6 Oct 2024 10:34:43 -0600 Subject: [PATCH] Fix date metadata for filenames with extra chars --- .changeset/perfect-rockets-agree.md | 5 +++++ src/cli.ts | 3 +++ 2 files changed, 8 insertions(+) create mode 100644 .changeset/perfect-rockets-agree.md diff --git a/.changeset/perfect-rockets-agree.md b/.changeset/perfect-rockets-agree.md new file mode 100644 index 0000000..a19f0b4 --- /dev/null +++ b/.changeset/perfect-rockets-agree.md @@ -0,0 +1,5 @@ +--- +'@tidaltheory/lens': patch +--- + +Fix ModifyDate if filenames include characters after the timestamp diff --git a/src/cli.ts b/src/cli.ts index 1a640f1..400df67 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -238,6 +238,9 @@ prog.command('jpg ') let sharpImage = sharp(source) spinner.text = 'Converting to JPG...' + // Remove any non-digit characters from the end of the filename. + name = name.replace(/\D*$/, '') + let dt = name.slice(-14) let d = dt.slice(0, 8) let t = dt.slice(8)