added more helper methods.

This commit is contained in:
DESKTOP-T0O5CDB\DESK-555BD
2024-01-22 11:09:01 -07:00
parent aad1655f2e
commit 175ce2be48
2 changed files with 7 additions and 2 deletions

View File

@@ -65,6 +65,11 @@
input = input.replace(decimalSeparator, ".");
return parseFloat(input);
}
function globalFloatToString(input) {
var decimalSeparator = "@numberFormat.NumberDecimalSeparator";
input = input.replace(".", decimalSeparator);
return input;
}
</script>
@await RenderSectionAsync("Scripts", required: false)
</head>

View File

@@ -99,12 +99,12 @@ function getAndValidateGasRecordValues() {
}
if (gasCostType != undefined && gasCostType == 'unit') {
var convertedGasCost = globalParseFloat(gasCost) * globalParseFloat(gasGallons);
gasCost = convertedGasCost.toFixed(2).toString();
if (isNaN(gasCost))
if (isNaN(convertedGasCost))
{
hasError = true;
$("#gasRecordCost").addClass("is-invalid");
} else {
gasCost = globalFloatToString(convertedGasCost.toFixed(2).toString());
$("#gasRecordCost").removeClass("is-invalid");
}
}