Commit d202f657 authored by Mark Harding's avatar Mark Harding

(fix): round to 6 decimals vs 4 and support starting with period - closes #1902

No related merge requests found
Pipeline #82378290 waiting for delayed job with stages
in 51 minutes and 43 seconds
......@@ -70,7 +70,7 @@
<input
type="text"
class="m-wire--creator-wide-input--edit"
[ngModel]="wire.amount | number"
[ngModel]="wire.amount"
(ngModelChange)="setAmount($event)"
(focus)="amountEditorFocus()"
(blur)="amountEditorBlur()"
......
......@@ -322,13 +322,24 @@ export class WireCreatorComponent {
return;
}
if (amount.indexOf('.') === 0) {
if (amount.length === 1) {
return; // not propogration
}
amount = `0${amount}`;
}
if (typeof amount === 'number') {
this.wire.amount = amount;
console.log('amount is a number');
return;
}
amount = amount.replace(/,/g, '');
this.wire.amount = parseFloat(amount);
const amountAsFloat = parseFloat(amount);
if (amountAsFloat) {
this.wire.amount = amountAsFloat;
}
}
/**
......@@ -355,11 +366,11 @@ export class WireCreatorComponent {
}
/**
* Round by 4
* Round by 6
*/
roundAmount() {
this.wire.amount =
Math.round(parseFloat(`${this.wire.amount}`) * 10000) / 10000;
Math.round(parseFloat(`${this.wire.amount}`) * 1000000) / 1000000;
}
// Charge and rates
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment