diff options
| author | Ken D'Ambrosio <ken@jots.org> | 2026-05-09 15:53:18 +0000 |
|---|---|---|
| committer | Ken D'Ambrosio <ken@jots.org> | 2026-05-09 15:53:18 +0000 |
| commit | fa36e54d878a3274f7728eb0b84c351b33f3c6ed (patch) | |
| tree | ab141eeecd013ec9e2eeb0ac919dbc84cd328c90 | |
| parent | b1ffa9050e63329ac72cfc9cca5b44800984e34c (diff) | |
Fix taken_at timezone: store and display as camera local time
EXIF DateTimeOriginal has no timezone — it's the camera's wall clock.
Storing it via .iso8601 attached +00:00 (server TZ), causing browsers
to shift the time to their local zone when parsing. Switch to
strftime('%Y-%m-%dT%H:%M:%S') so no offset is written. JS strips any
existing +00:00 suffix from already-stored values so old data is also
displayed correctly.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| -rw-r--r-- | public/js/album.js | 2 | ||||
| -rw-r--r-- | scripts/update.rb | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/public/js/album.js b/public/js/album.js index 9e921d7..fe492af 100644 --- a/public/js/album.js +++ b/public/js/album.js @@ -38,7 +38,7 @@ function lbBuildInfo(e) { const rows = []; if (e.name !== e.title) rows.push(['File', e.name]); if (e.taken_at) { - const d = new Date(e.taken_at); + const d = new Date(e.taken_at.replace(/[+-]\d{2}:\d{2}$|Z$/, '')); rows.push(['Date', d.toLocaleString(undefined, { dateStyle: 'medium', timeStyle: 'short' })]); } if (e.width && e.height) rows.push(['Dimensions', `${e.width} × ${e.height}`]); diff --git a/scripts/update.rb b/scripts/update.rb index 7ff0007..8e4cdd5 100644 --- a/scripts/update.rb +++ b/scripts/update.rb @@ -80,7 +80,7 @@ def enrich_image(full, name, meta) exif = MiniExiftool.new(full, numerical: false) raw = exif.date_time_original || exif.create_date || exif.date_time if raw - meta['taken_at'] = raw.respond_to?(:iso8601) ? raw.iso8601 : raw.to_s + meta['taken_at'] = raw.respond_to?(:strftime) ? raw.strftime('%Y-%m-%dT%H:%M:%S') : raw.to_s puts " #{name}: taken_at = #{meta['taken_at']}" end rescue StandardError => e |
