Skip to content

ADR-0017: Editable currency, time, and export preview in the transaction editor

  • Status: Accepted
  • Date: 2026-08-12
  • Deciders: maintainers
  • Related: ADR-0009

Context

The transaction editor could only change amount, merchant, direction, category, status, and note. occurredAt and currency were fixed to values the capture pipeline derived (bank timestamp, base currency), which made manually-entered or imported transactions permanently wrong when the guess was off. Export format was also invisible until the user ran a full export from Settings.

Decision

The editor gains three capabilities:

  1. Currency dropdown — a read-only ExposedDropdownMenu over Currency.supportedCodes(). Selecting a currency re-renders the amount field through MoneyText.reformat, which preserves the minor-unit value and only changes digit representation (e.g. MYR 12.34 → JPY 1234). This is a representation change, never a foreign-exchange conversion — the Long minor-unit invariant (ADR-0009) is untouched. Unparseable amount text and same-currency selections pass through unchanged.
  2. Date & time pickers — tapping the date field opens Material 3 DatePickerDialog, then a TimePicker dialog. The combined local date/time replaces occurredAt (epoch millis), which was already a settable draft field but never wired to the UI.
  3. Export preview — a code icon in the top bar serializes the current draft the same way a full export would (TransactionDraft.toExportRow mirrors ExportRepository.rows()), resolves category/account display names, and shows the pretty-printed JSON in a dialog with a copy action. The shared pure mapper is the single source of truth for entity → export row field mapping.

Consequences

  • Correcting a mis-parsed transaction is now possible without re-importing.
  • Currency edits never silently reinterpret stored minor units; switching between equal-digit currencies keeps the display identical.
  • The preview makes export format debuggable from the affected record, and the pure toExportRow mapper is JVM unit-tested.

Alternatives considered

  • Keep the amount text byte-for-byte when switching currency — rejected: a 2-digit amount shown in a 0-digit currency would silently round on save; reformatting keeps what the user typed meaningful.
  • Reuse ExportRepository for the preview — rejected: it reads from the DB; the preview must reflect the unsaved draft.