Repository navigation
Closed
Description
Problem
shift_iso (crates/catalog/src/dates.rs:46) shifts whatever iso_seconds (crates/catalog/src/stacks.rs:290) can read, and copies the rest of the string into the result without checking it. So a capture time that is only partly readable comes out of Edit Capture Time looking valid, but it's wrong or doesn't read back. Such strings reach the catalog through Lightroom catalog imports, which copy captureTime as it is (crates/engine/src/lightroom_catalog.rs:968).
- A time that is cut short loses its hour.
2026-01-01T10:0and2026-01-01T10are read as midnight (stacks.rs:298needs 16 bytes for a time). A one-hour shift writes2026-01-01T01:00:00. - Unreadable seconds become zero.
2026-01-01T10:00:xxreads as10:00:00(num(17, 19).unwrap_or(0),stacks.rs:298). The shift writes a clean-looking11:00:00. - Anything after the time is kept as it is. The tail is copied unchecked (
dates.rs:53).2026-01-01T10:00:00+becomes…T11:00:00+, and2026-01-01T10:00:00 and morebecomes…T11:00:00 and more, which isn't a time. - Photos it can't shift are skipped without a word.
photo.setCaptureTimedrops a photo whose time doesn't read (crates/engine/src/cmd/manage.rs:227-233). Its result,{changed, captured}(manage.rs:253), doesn't say how many were skipped. - The preview shows the wrong message. In the dialog's Shift and Time Zone modes, the preview for such a photo says "Enter a date as YYYY-MM-DD HH:MM:SS" (
crates/ui-egui/src/panels/dialogs.rs:529), though the user typed no date.
Follows issue #2146, which fixed a time with minutes but no seconds.
Proposed fix
shift_isoreturnsNoneunless the input is one of:- a date alone;
- a date and a time (
Tor a space between them) with hours and minutes, optional seconds with an optional fraction (.5), and an optional zone (Z,+02:00,-0500,+02), and nothing after. A fraction after the minutes (10:00.5, half a minute) is refused too: it would come back as half a second.
- Seconds, when present, must be digits.
iso_secondsstays lenient for reading and sorting; only the write path gets stricter. photo.setCaptureTimerefuses to set a time for the active photo when that photo's own time can't be read and other selected photos would move by an amount read from it. With that photo alone, or setting every photo's time (each), it gets the time, which repairs it. The dialog shows the refusal and stays open.photo.setCaptureTimecounts the photos it skipped because their time doesn't read (unreadablein its result), separately from the "outside 0000–9999" refusal, and the dialog reports them.- When the problem is the photo's own time, the dialog preview says the active photo's capture time can't be read, instead of asking for a date.
Acceptance criteria
- AC-1:
shift_isoreturnsNonefor2026-01-01T10:0,2026-01-01T10,2026-01-01T,2026-01-01T10:00:xx,2026-01-01T10:00:00+,2026-01-01T10:00:00+2,2026-01-01T10:00:00.and2026-01-01T10:00:00 and more, and doesn't panic on multi-byte characters at bytes 11, 16, 18 and 21. - AC-2:
shift_isostill shifts a date alone, a time with and without seconds, a fraction, and the zonesZ,+02:00,-0500and+02, keeping the fraction and zone; each result reads back throughshift_iso(…, 0)unchanged. - AC-3: Sorting, grouping and smart-collection date rules still read the strings
iso_secondsreads today (no change toiso_seconds's results for existing tests). - AC-4:
photo.setCaptureTimeon two photos, one with a readable time and one with2026-01-01T10:00:00 and more, shifts the first, leaves the second unchanged, and returnsunreadable: 1, in one undo step. - AC-5: A photo with a malformed tail isn't counted as "outside the years 0000–9999": that error comes only from a time that reads but would shift out of range.
- AC-6: In the Edit Capture Time dialog's Shift mode, the preview for an active photo whose time can't be read says so, not "Enter a date as YYYY-MM-DD HH:MM:SS" (UI test in
crates/ui-egui/src/tests_<area>.rs). - AC-7: Each new test of changed behaviour fails on
mainbefore the change. - AC-8: Help ▸ What's New has an entry (
docs/whats-new.md). - AC-9: OK in the Edit Capture Time dialog with such a photo leaves it unchanged, closes the dialog and says that photos whose capture time can't be read were left as they were (UI test).
- AC-10:
photo.setCaptureTimewith atimefor the active photo (noteach) is refused, with an error that says so and no photo changed, when that photo's own capture time can't be read and other selected photos would move by its change. With that photo alone it gets the typed time (repairing it), and witheach: trueevery selected photo gets it, the unreadable one included. - AC-11: In the Edit Capture Time dialog's Set mode, the refusal of AC-10 is shown and the dialog stays open; with the unreadable photo alone, the preview shows the time it will get and OK sets it (UI test).
- AC-12: Any error from
photo.setCaptureTimein the Edit Capture Time dialog (a typed time that isn't a date, a shift past year 9999, AC-10's refusal) is shown and the dialog stays open, from its OK button and from the control channel'sui.dialog.confirmalike; before, the dialog closed without a word (UI test). - AC-13: The dialog doesn't prefill Set mode with an unreadable capture time (
2026-01-01T10:0would read as midnight); the field starts empty, and with that photo alone the preview asks for a date (UI test).
Activity
ticket-craft commentedon Oct 22, 2026
Thanks! This ticket describes several separate problems:
It helps a lot if each one has its own ticket, so they can be tracked and fixed separately.
catalog: refuse to shift a capture time that does not read (storytold…
mdlmarkham commentedon Oct 22, 2026
Fixed on #2174 (commit aa77898). What landed:
crates/catalog/src/dates.rs): a capture time must read as a date or it is reported as unreadable;readable_isosays whether a value would survive a shift,shift_isorefuses what it can't read, and out-of-range results (past the years 0000–9999) are refused up front as before.photo.setCaptureTime): photos whose time can't be read are left exactly as they were and counted in the result (unreadable); the readable ones still move. Nothing is written for a photo that would not parse.2026-01-01T10:0) is refused — it would silently become midnight — and the error names the file. With the unreadable photo alone, the typed time is accepted as a repair.Edit Capture Time): the preview says why nothing would move ("can't be read" rather than "Enter a date"), a result that left photos untouched toasts how many ("Photos whose capture time can't be read were left as they were: 1"), and errors keep the dialog open — from the OK button and the control channel (ui.dialog.confirm) alike, so the typed choices are not lost.dates.rs,manage.rs/tests_libops.rsandtests_dialogs.rs(preview, prefill, unreadable-left-and-counted, refusal, repair, stay-open on both paths).#2505: Edit Capture Time leaves a capture time it can't fully read as…