eventbrite / currint Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
currint
version: 1.6.1
Currency.format_decimal
returns an incorrect value if divisor
is set, and it is not a power of 10. Instead of returning a decimal number representing the fractional number of major units, it returns the number of minor units on the right side of the decimal.
This impacts currencies like the Mauritanian ouguiya (MRO), whose minor unit is 1/5th the value of the major unit (1.2 ouguiya (major) = 6 khoum (minor)). For example, currencies['MRO'].format_decimal(6)
produces '1.1' (1 ouguiya and half a khoum) instead of '1.2'.
To reproduce:
from currint import currencies
currencies['MRO'].format_decimal(6)
# '-1.1' ๐
# Passing back in the result of `format_decimal` into `major_to_minor_value` raises a value error
# ".1" is intepreted as half a khoum
currencies['MRO'].major_to_minor_value(Decimal('1.1'))
# ValueError: Cannot convert major amount Decimal('1.1') to minor amount; would result in fractional amount of minor unit)
currint
version: 1.6.1
Passing a negative value less than 0 and greater than -1 major units to Currency.format_decimal
will return a string formatted as a positive value.
To reproduce:
from currint import currencies
currencies['USD'].format_decimal(-100)
# u'-1.00' ๐
currencies['USD'].format_decimal(-99)
# u'0.99' ๐ข
currint
version: 1.6.1
Currency.format
includes a trailing dot 0 (".0") for currencies with a 0 exponent (a la ยฅ). Currencies without a minor unit (0 exponent) should return a whole number without the trailing ".0".
To reproduce:
from currint import currencies
currencies["JPY"].format(100)
# "100.0 JPY"
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.