Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrectly parse with three decimal numbers #63

Closed
luismomm2110 opened this issue Nov 24, 2023 · 2 comments
Closed

Incorrectly parse with three decimal numbers #63

luismomm2110 opened this issue Nov 24, 2023 · 2 comments

Comments

@luismomm2110
Copy link

price = Price.fromstring("1,234,567.890")

it should be

Decimal('1234569.890')

is

Decimal(1234569890)

@Gallaecio Gallaecio marked this as a duplicate of #67 Feb 3, 2025
@Gallaecio
Copy link
Member

#59 (merged but not yet released) could help here.

@Gallaecio Gallaecio marked this as a duplicate of #68 Feb 4, 2025
@Gallaecio
Copy link
Member

If you know the decimal separator of the number beforehand, you can use it to work around this:

>>> Price.fromstring("1,234,567.890")
Price(amount=Decimal('1234567890'), currency=None)
>>> Price.fromstring("1,234,567.890", decimal_separator=".")
Price(amount=Decimal('1234567.890'), currency=None)

Though I do think price-parser should be able to extract the number correctly without further arguments for this example input.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants