aboutsummaryrefslogtreecommitdiff
path: root/main.ts
diff options
context:
space:
mode:
Diffstat (limited to 'main.ts')
-rw-r--r--main.ts4
1 files changed, 2 insertions, 2 deletions
diff --git a/main.ts b/main.ts
index a101d9f..ab3f2bf 100644
--- a/main.ts
+++ b/main.ts
@@ -36,7 +36,7 @@ const inputs = setInputs(itemEntries)
inputs.map(input => {
input.node.oninput = e => {
if (e.target !==null) {
- const parsed: ParsedNumber | undefined = parseNumber((e.target as HTMLInputElement).value)
+ const parsed = parseNumber((e.target as HTMLInputElement).value)
if (parsed !== undefined && parsed.before === '' && parsed.after === '') {
const factor = parsed.number / input.number
@@ -152,7 +152,7 @@ function parseNumber(str: string): ParsedNumber | undefined {
return {
before: str.substring(0, start),
- number: parseFloat(integerPart + (decimalPart !== '' ? '.' + decimalPart : '')),
+ number: parseFloat(integerPart + (decimalPart !== '' ? '.' + decimalPart.substring(0, 2) : '')),
after: str.substring(end, str.length)
}
}