From 954524526718b4534ab769be24d9aceaacf773f8 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Mon, 27 Jun 2022 10:31:14 +0200 Subject: [PATCH] Fix empty input handling of fromUserInput --- packages/math/src/decimal.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/math/src/decimal.ts b/packages/math/src/decimal.ts index 0a6a798b..6e23489c 100644 --- a/packages/math/src/decimal.ts +++ b/packages/math/src/decimal.ts @@ -24,7 +24,10 @@ export class Decimal { let whole: string; let fractional: string; - if (input.search(/\./) === -1) { + if (input === "") { + whole = "0"; + fractional = ""; + } else if (input.search(/\./) === -1) { // integer format, no separator whole = input; fractional = "";