From 6c9302f9853d931ecf2f4385fa77b78d367f89e2 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 18 Jun 2018 13:50:21 -0230 Subject: [PATCH] Remove leading zeroes from send screen amount row input. --- ui/app/components/send/currency-display.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/app/components/send/currency-display.js b/ui/app/components/send/currency-display.js index 9866393d8..e410bc070 100644 --- a/ui/app/components/send/currency-display.js +++ b/ui/app/components/send/currency-display.js @@ -92,8 +92,12 @@ CurrencyDisplay.prototype.getConvertedValueToRender = function (nonFormattedValu : convertedValue } +function removeLeadingZeroes (str) { + return str.replace(/^0*(?=\d)/, '') +} + CurrencyDisplay.prototype.handleChange = function (newVal) { - this.setState({ valueToRender: newVal }) + this.setState({ valueToRender: removeLeadingZeroes(newVal) }) this.props.onChange(this.getAmount(newVal)) }