Skip to content

Fix: Support currency format in transaction amount validation - #20399

Merged
raycastbot merged 3 commits into
raycast:mainfrom
damian-duchnowski:ext/raynab
Aug 4, 2025
Merged

raycastbot merged 3 commits into
raycast:mainfrom
damian-duchnowski:ext/raynab

Conversation

@damian-duchnowski

@damian-duchnowski damian-duchnowski commented Jul 12, 2025 •

Copy link
Copy Markdown
Contributor

Description

Problem

Users with non-US currency formats (e.g., European "1.234,56" vs US "1,234.56") were unable to enter amounts in the Add Transaction form due to validation errors. The form validation was using Number(value) directly without accounting for different currency separator configurations from YNAB.

Solution

Updated the amount validation in transactionCreateForm.tsx to normalize the input based on the budget's currency format settings, using the same logic as the existing formatToYnabAmount function:

// Before
const num = Number(value);

// After  
const normalizedAmount = activeBudgetCurrency
  ? value.replaceAll(activeBudgetCurrency.group_separator, '').replaceAll(activeBudgetCurrency.decimal_separator, '.')
  : value;
const num = Number(normalizedAmount);

Changes Made

  • File: src/components/transactions/transactionCreateForm.tsx
  • Lines: 261-267 (amount validation logic)
  • Changelog: Added entry for currency format validation fix

Benefits

  • ✅ Fixes the reported issue from GitHub Raynab #20369
  • ✅ Maintains backward compatibility with standard number formats
  • ✅ Aligns with existing codebase using the same normalization logic as formatToYnabAmount
  • ✅ Supports international users with different currency preferences
  • ✅ No breaking changes - existing functionality remains intact

Testing

The fix ensures that:

  • Standard formats like "123.45" and "-123.45" continue to work
  • European formats like "1.234,56" now work correctly
  • Validation gracefully handles null/undefined currency settings
  • Error messages remain consistent

Related Issues

Closes #20369

Checklist

- style: apply linter fixes
- fix: improve amount validation to handle different currency formats
- Initial commit
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: raynab Issues related to the raynab extension AI Extension labels Jul 12, 2025
@raycastbot

raycastbot commented Jul 12, 2025 •

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! 🎉

🔔 @gogocharli @omarshahine you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

Due to our current reduced availability during summer, the initial review may take up to 10-15 business days.

@raycastbot raycastbot added the OP is contributor The OP of the PR is a contributor of the extension label Jul 12, 2025
@damian-duchnowski damian-duchnowski changed the title Update raynab extension Fix: Support currency format in transaction amount validation Jul 12, 2025
@damian-duchnowski
damian-duchnowski marked this pull request as ready for review July 12, 2025 13:36

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR Summary

Updates transaction amount validation in RAYNAB extension to properly handle international currency formats, fixing input validation for non-US formats like European '1.234,56'.

  • Fixed form validation in extensions/raynab/src/components/transactions/transactionCreateForm.tsx to normalize currency inputs based on budget settings before validation
  • Added graceful handling for null/undefined currency settings while maintaining backward compatibility
  • Code reuses existing formatToYnabAmount logic for consistent currency handling across the extension

2 files reviewed, 1 comment
Edit PR Review Bot Settings | Greptile

@andreaselia

Copy link
Copy Markdown
Contributor

Hey @damian-duchnowski, nice work!

@gogocharli, fancy checking this?

@gogocharli gogocharli left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for debugging and fixing this, @damian-duchnowski! It's working great ✅

@damian-duchnowski

damian-duchnowski commented Jul 27, 2025 •

Copy link
Copy Markdown
Contributor Author

Hey @andreaselia! When you have a moment, could you please approve it? Thank you!

@andreaselia

Copy link
Copy Markdown
Contributor

Hey @damian-duchnowski 👋

Sorry for the delay, this LGTM, thanks for your contribution mate!

@raycastbot
raycastbot merged commit 77a58b7 into raycast:main Aug 4, 2025
@github-actions

github-actions Bot commented Aug 4, 2025

Copy link
Copy Markdown
Contributor

@raycastbot

Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

@damian-duchnowski
damian-duchnowski deleted the ext/raynab branch August 4, 2025 10:40
NormCopeland added a commit to NormCopeland/raycast-extensions that referenced this pull request Aug 6, 2025