Skip to content

fix(import): name date folders by local capture date, not UTC - #2137

Open
mandishshah wants to merge 1 commit into
CyberTimon:mainfrom
mandishshah:fix/import-date-folder-local-time
Open

mandishshah wants to merge 1 commit into
CyberTimon:mainfrom
mandishshah:fix/import-date-folder-local-time

Conversation

@mandishshah

Copy link
Copy Markdown

Description

Since #1632, get_creation_date_from_path / get_creation_date_from_bytes correctly treat an offset-less EXIF DateTimeOriginal as local wall-clock time and return it as a DateTime<Utc>. That fixed export timestamps, but import_files still formats the Organize by date subfolder straight from that UTC value, so the folder is the UTC calendar date.

West of UTC this files every evening photo into the next day's folder. With the system timezone set to America/Los_Angeles:

DateTimeOriginal Folder before Folder after
2026:11:06 17:39:21 (PST) 2026/11-07 2026/11-06
2026:09:21 17:39:21 (PDT) 2026/09-22 2026/09-21

(East of UTC, early-morning photos go to the previous day.) The filename template was not affected, because generate_filename_from_template already converts with with_timezone(&chrono::Local), so a {YYYY}{MM}{DD} filename and its folder could disagree by a day.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Performance improvement
  • Code refactoring
  • Documentation update
  • UI/UX improvement
  • Build/CI or Dependency update

Changes Made

  • import_files (desktop and Android branches): convert file_date to chrono::Local before formatting the date subfolder, matching generate_filename_from_template.

Screenshots/Videos

Not applicable.

Testing

  • These changes were tested locally by a human and confirmed to work.
  • I haven't added any automated tests to the code because the codebase currently lacks a test suite.

What was checked:

  • cargo fmt -p RapidRAW -- --check passes.
  • cargo clippy --all-targets -- -D warnings passes on macOS, apart from one pre-existing, unrelated lint in src/apple_raw.rs (chunks_exact_to_as_chunks) that also fails on main with the pinned 1.98 toolchain.
  • The folder logic (a copy of creation_datetime_to_utc plus the old and new formatting, chrono 0.4.45) was run with TZ set to America/Los_Angeles, Pacific/Honolulu, UTC, Asia/Kolkata and Pacific/Auckland for evening, late-night, just-after-midnight and DST-change capture times. The old code files photos one day late west of UTC and one day early east of UTC (e.g. 2026:02:15 00:00:01 → 2026/02-14 in Asia/Kolkata); with the fix every case lands in the capture date's folder.
  • Not yet tested end to end through the app's Import dialog.

Test Configuration:

  • OS: macOS 26
  • Hardware: Apple Silicon

Checklist

  • My code follows the project's code style
  • I haven't added unnecessary AI-generated code comments
  • My changes generate no new warnings or errors

Additional Notes

Libraries already imported with an affected version can have photos one folder off (evening shots west of UTC, early-morning shots east of UTC); this PR only changes new imports and does not move existing files.

AI Disclaimer:

  • This PR is created by an AI agent
  • This PR is mostly AI-generated but edited/merged together by a human
  • This PR was handwritten with AI assistance (spell check, logic suggestions, error resolving)
  • This PR contains only blood, sweat, and coffee (AI-free)

🤖 Generated with Claude Code

Since CyberTimon#1632 the EXIF capture time is resolved as local time and returned
as DateTime<Utc>, but import_files still formatted the "organize by
date" subfolder from the UTC value. West of UTC, evening photos landed
in the next day's folder; east of UTC, early-morning photos in the
previous day's. Convert to Local before formatting, as
generate_filename_from_template already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant