Skip to content

Commit

Permalink
not allowed to input negative nums
Browse files Browse the repository at this point in the history
  • Loading branch information
oybek committed Oct 21, 2023
1 parent 4188d0a commit 64889fa
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion spendbook/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@
if (category === categories[categories.length-1]) {
category = $("#custom_input").val();
}
const rawAmountValue = parseInt($("#amount").val(), 10);
const absAmountValue = Math.abs(rawAmountValue)
$("#amount").val(absAmountValue);
const data = {
category: category,
amount: parseInt($("#amount").val(), 10),
amount: absAmountValue,
description: $("#text").val(),
date: $("#date_input").val(),
timeOffset: new Date().getTimezoneOffset(),
Expand Down

0 comments on commit 64889fa

Please sign in to comment.