Replaced the deprecated JavaScript String.substr with String.substring.

This commit is contained in:
依瑪貓 2022-12-05 19:32:43 +08:00
parent 1c44d51e92
commit 3792524022
2 changed files with 3 additions and 3 deletions

View File

@ -75,7 +75,7 @@ function updateParent(code) {
parent.text(gettext("Topmost"));
return;
}
const parentCode = code.value.substr(0, code.value.length - 1);
const parentCode = code.value.substring(0, code.value.length - 1);
if (parentCode in accounts) {
parent.text(parentCode + " " + accounts[parentCode]);
return;
@ -136,7 +136,7 @@ function validateCode() {
return false;
}
}
const parentCode = code.value.substr(0, code.value.length - 1);
const parentCode = code.value.substring(0, code.value.length - 1);
if (!(parentCode in accounts)) {
code.classList.add("is-invalid");
errorMessage.text(gettext("The parent account of this code does not exist."));

View File

@ -298,7 +298,7 @@ function parseSummaryForHelper(summary) {
const pos = summary.lastIndexOf("×");
let count = 1;
if (pos !== -1) {
count = parseInt(summary.substr(pos + 1));
count = parseInt(summary.substring(pos + 1));
}
if (count === 0) {
count = 1;