react-currency-input-field
Advanced tools
Comparing version 3.7.0 to 3.7.1
@@ -192,2 +192,5 @@ import React, { forwardRef, useMemo, useState, useRef, useImperativeHandle, useEffect } from 'react'; | ||
: _value; | ||
if (decimalSeparator && decimalSeparator !== '-' && value.startsWith(decimalSeparator)) { | ||
value = '0' + value; | ||
} | ||
var defaultNumberFormatOptions = { | ||
@@ -194,0 +197,0 @@ minimumFractionDigits: decimalScale || 0, |
@@ -200,2 +200,5 @@ (function (global, factory) { | ||
: _value; | ||
if (decimalSeparator && decimalSeparator !== '-' && value.startsWith(decimalSeparator)) { | ||
value = '0' + value; | ||
} | ||
var defaultNumberFormatOptions = { | ||
@@ -202,0 +205,0 @@ minimumFractionDigits: decimalScale || 0, |
{ | ||
"name": "react-currency-input-field", | ||
"version": "3.7.0", | ||
"version": "3.7.1", | ||
"description": "React <input/> component for formatting currency and numbers.", | ||
@@ -5,0 +5,0 @@ "files": [ |
@@ -287,2 +287,2 @@ # React Currency Input Field Component | ||
If you want to contribute to this repository, please refer to the [contributing doc](https://github.com/cchanxzy/react-currency-input-field/blob/main/docs/CONTRIBUTING.md) | ||
If you want to contribute to this repository, please refer to the [contributing doc](https://github.com/cchanxzy/react-currency-input-field/blob/main/docs/CONTRIBUTING.md). |
@@ -206,2 +206,14 @@ import { formatValue } from '../formatValue'; | ||
it('should prefix decimal values correctly with zero', () => { | ||
expect( | ||
formatValue({ | ||
decimalSeparator: '.', | ||
groupSeparator: ',', | ||
decimalScale: 2, | ||
prefix: '$', | ||
value: '.02', | ||
}) | ||
).toEqual('$0.02'); | ||
}); | ||
describe('negative values', () => { | ||
@@ -208,0 +220,0 @@ it('should handle negative values', () => { |
@@ -82,3 +82,3 @@ import { IntlConfig } from '../CurrencyInputProps'; | ||
const value = | ||
let value = | ||
decimalSeparator !== '.' | ||
@@ -88,2 +88,6 @@ ? replaceDecimalSeparator(_value, decimalSeparator, isNegative) | ||
if (decimalSeparator && decimalSeparator !== '-' && value.startsWith(decimalSeparator)) { | ||
value = '0' + value; | ||
} | ||
const defaultNumberFormatOptions = { | ||
@@ -90,0 +94,0 @@ minimumFractionDigits: decimalScale || 0, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
301390
5406