# T07: Compatibility-Preserving Refactor

`ledger/cli.py` and `ledger/query.py` each implement their own ISO date-boundary parsing. Extract the duplicated logic into `ledger/dates.py` so CLI validation and query filtering share one implementation.

Keep the signature, return type, `ValueError` behavior on date errors of `ledger.query.filter_by_date(transactions, start_date=None, end_date=None)`, and the CLI's error output and exit status for illegal dates compatible. No unrelated formatting or repo-wide renames; do not delete or modify existing tests or add runtime dependencies. You may add compatibility tests.

Run `python3 -m unittest discover -s tests -v`, and explain the responsibility changes before and after the refactor plus the actual verification results.
