Skip to content

Commit abf5602

Browse files
committed
Inputting 0.000000001 into the send form creates 1e-9 #225
1 parent fbdc8a2 commit abf5602

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/components/content/SendCoinsDialogContent.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ class SendCoinsDialogContent extends React.Component<DecoratedProps, State> {
227227
handleAmountBlur = () => {
228228
const amountInvalid = !!this.state.amount && !!this.amountError();
229229
const amount = this.state.parsedAmount
230-
? this.state.parsedAmount.unit.toNumber().toString()
230+
? this.state.parsedAmount.unit.toString()
231231
: '';
232232
this.setState({
233233
amountInvalid,

src/utils/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { RawAmount } from './amounts';
77

88
// magic...
99
const epoch = Date.UTC(2016, 4, 24, 17, 0, 0, 0) / 1000;
10+
BigNumber.config({ EXPONENTIAL_AT: 1e+9 });
1011

1112
export function timestampToUnix(timestamp: number) {
1213
return new Date((timestamp + epoch) * 1000).getTime();
@@ -78,7 +79,8 @@ export function normalizeNumber(intl: InjectedIntl, value: string): string {
7879
if (isNaN(n.toNumber())) {
7980
return '';
8081
}
81-
return n.toString();
82+
const minSafe = BigNumber.max(n, new BigNumber(0.00000001));
83+
return minSafe.toString();
8284
} catch (e) {
8385
return '';
8486
}

0 commit comments

Comments
 (0)