Revert "Fix autopay day parsing in mini app"

This commit is contained in:
Egor
2025-10-11 05:16:39 +03:00
committed by GitHub
parent 6bfb484a9b
commit b730de4175

View File

@@ -8937,25 +8937,10 @@
function coercePositiveInt(value, fallback = null) {
const numeric = coerceNumber(value, null);
let candidate = numeric;
if (candidate === null || Number.isNaN(candidate)) {
if (typeof value === 'string') {
const normalized = value.trim();
if (normalized) {
const match = normalized.match(/\d+/);
if (match) {
candidate = Number(match[0]);
}
}
}
}
if (candidate === null || Number.isNaN(candidate)) {
if (numeric === null || Number.isNaN(numeric)) {
return fallback;
}
const intValue = Math.trunc(candidate);
const intValue = Math.trunc(numeric);
return Number.isFinite(intValue) && intValue >= 0 ? intValue : fallback;
}