Add null guard for querySelector and fix days using raw input value

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-09 17:10:15 +08:00
parent b3e5554133
commit b10fcc057e

View File

@@ -216,7 +216,7 @@ function onChange(event) {
tUnits.value[dsp].val = decoratedInputValue; tUnits.value[dsp].val = decoratedInputValue;
switch (dsp) { switch (dsp) {
case "d": case "d":
days.value = baseInputValue; days.value = decoratedInputValue;
break; break;
case "h": case "h":
hours.value = decoratedInputValue; hours.value = decoratedInputValue;
@@ -297,7 +297,7 @@ function incrementPreviousUnit(input) {
const prevUnit = document.querySelector( const prevUnit = document.querySelector(
`input[data-index="${parseInt(input.dataset.index) - 1}"]`, `input[data-index="${parseInt(input.dataset.index) - 1}"]`,
); );
actionUpDown(prevUnit, true); if (prevUnit) actionUpDown(prevUnit, true);
} }
} }