Skip to content

fix(#134): append statement_year to yearless CC dates in output#137

Merged
longieirl merged 1 commit intomainfrom
fix/134-cc-date-year-in-output
Apr 9, 2026
Merged

fix(#134): append statement_year to yearless CC dates in output#137
longieirl merged 1 commit intomainfrom
fix/134-cc-date-year-in-output

Conversation

@longieirl
Copy link
Copy Markdown
Owner

Summary

CC statement transactions use yearless date strings (e.g. 3 Feb). The statement_year was already extracted and stored in additional_fields for sorting, but was never written back into the Date column in output. This fix enriches the date at serialisation time so all output formats (CSV, JSON, Excel, monthly_summary, expense_analysis) show 3 Feb 2025 instead of 3 Feb.

Closes #134

Changes

  • Transaction._enrich_date(date_str, additional_fields) — detects yearless dates via regex and appends statement_year when present
  • Transaction.to_dict() — calls _enrich_date for the Date field
  • 9 new tests in TestTransactionEnrichDate covering unit and integration paths

Type

  • Bug fix

Testing

  • Tests pass (coverage ≥ 91%)
  • Manually tested

Checklist

  • Code follows project style
  • Self-reviewed
  • Documentation updated (if needed)
  • No new warnings

Downstream impact

  • This PR changes a public interface in bankstatements_core (exported class, function, or exception)

…tput

Add Transaction._enrich_date() which detects yearless date strings (e.g.
'3 Feb') and appends statement_year from additional_fields. Called from
to_dict() so all output paths (CSV, JSON, Excel, monthly_summary,
expense_analysis) automatically receive the enriched date.

Nine new tests cover unit behaviour of _enrich_date and integration
through to_dict().
@longieirl longieirl self-assigned this Apr 9, 2026
@github-actions github-actions bot added the bug Something isn't working label Apr 9, 2026
@longieirl longieirl merged commit f6062c5 into main Apr 9, 2026
11 checks passed
@longieirl longieirl deleted the fix/134-cc-date-year-in-output branch April 9, 2026 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CC statements: append year to Date column in all output formats

2 participants