[PR #6565] fix(budget-automations): Fix period text display and currency conversion in automation UI #6604

Closed
opened 2026-02-28 21:30:34 -06:00 by GiteaMirror · 0 comments
Owner

Original Pull Request: https://github.com/actualbudget/actual/pull/6565

State: closed
Merged: No


Summary

Fixes multiple issues in the budget automation UI components:

  • Crash with decimal amounts - SimpleAutomationReadOnly crashed when template amounts contained decimals (e.g., $50.25) because raw float values were passed to a function expecting integers
  • Period text display - WeekAutomationReadOnly showed "each week" regardless of actual period configuration. Now correctly displays dynamic text like "every 2 weeks", "every 3 months", etc.
  • Amount conversion - Template amounts (stored as dollars by the parser) were not being converted to cents before display, causing incorrect values
  • Currency-aware conversion - WeekAutomation and WeekAutomationReadOnly now use the currency's decimal places setting instead of hardcoded values

Changes

File Change
WeekAutomationReadOnly.tsx Added getPeriodText() for dynamic period display + currency-aware conversion
WeekAutomation.tsx Added currency-aware conversion using format.currency.decimalPlaces
SimpleAutomationReadOnly.tsx Added amountToInteger with currency-aware decimal places (fixes crash)

Screenshots

Before (crash on decimal amounts)

CleanShot 2026-01-06 at 17 29 00

After (all fixes applied)

  • JPY
    CleanShot 2026-01-06 at 17 31 09

  • CAD
    CleanShot 2026-01-06 at 17 31 40

Test Plan

  • Added 8 tests for WeekAutomationReadOnly (period display + amount conversion)
  • Added 4 tests for SimpleAutomationReadOnly (amount conversion)
  • All desktop-client tests pass
  • TypeScript compiles without errors

Manual Testing

  • Create a periodic template with "every 2 weeks" and verify it displays correctly
  • Create a simple template with $100/month and verify correct display
  • Create a template with decimal amount (e.g., 819.54) and verify no crash
  • Set currency to JPY and test for correct format
**Original Pull Request:** https://github.com/actualbudget/actual/pull/6565 **State:** closed **Merged:** No --- ## Summary Fixes multiple issues in the budget automation UI components: - **Crash with decimal amounts** - SimpleAutomationReadOnly crashed when template amounts contained decimals (e.g., $50.25) because raw float values were passed to a function expecting integers - **Period text display** - WeekAutomationReadOnly showed "each week" regardless of actual period configuration. Now correctly displays dynamic text like "every 2 weeks", "every 3 months", etc. - **Amount conversion** - Template amounts (stored as dollars by the parser) were not being converted to cents before display, causing incorrect values - **Currency-aware conversion** - WeekAutomation and WeekAutomationReadOnly now use the currency's decimal places setting instead of hardcoded values ## Changes | File | Change | |------|--------| | `WeekAutomationReadOnly.tsx` | Added `getPeriodText()` for dynamic period display + currency-aware conversion | | `WeekAutomation.tsx` | Added currency-aware conversion using `format.currency.decimalPlaces` | | `SimpleAutomationReadOnly.tsx` | Added `amountToInteger` with currency-aware decimal places (fixes crash) | ## Screenshots ### Before (crash on decimal amounts) <img width="544" height="334" alt="CleanShot 2026-01-06 at 17 29 00" src="https://github.com/user-attachments/assets/9ef165e9-0454-4557-a8c9-d854c85530e1" /> ### After (all fixes applied) - JPY <img width="868" height="669" alt="CleanShot 2026-01-06 at 17 31 09" src="https://github.com/user-attachments/assets/509db9f8-05a1-47f0-8fff-4a75a5fb6715" /> - CAD <img width="875" height="665" alt="CleanShot 2026-01-06 at 17 31 40" src="https://github.com/user-attachments/assets/d766e3d4-ca1d-4aa9-a55b-c4ba6b6be7f1" /> ## Test Plan - [x] Added 8 tests for WeekAutomationReadOnly (period display + amount conversion) - [x] Added 4 tests for SimpleAutomationReadOnly (amount conversion) - [x] All desktop-client tests pass - [x] TypeScript compiles without errors ### Manual Testing - [x] Create a periodic template with "every 2 weeks" and verify it displays correctly - [x] Create a simple template with $100/month and verify correct display - [x] Create a template with decimal amount (e.g., 819.54) and verify no crash - [x] Set currency to JPY and test for correct format
GiteaMirror added the pull-request label 2026-02-28 21:30:34 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/actual#6604