fix bd leader history date parameter

This commit is contained in:
zhx 2026-05-07 17:33:00 +08:00
parent e274e9bfef
commit 9439cfec32
3 changed files with 17 additions and 7 deletions

View File

@ -12,7 +12,7 @@
source.searchParams.forEach(function (value, key) {
target.searchParams.set(key, value)
})
target.searchParams.set("h5v", "20260429-0335")
target.searchParams.set("h5v", "20260507-1726")
window.location.replace(target.toString())
</script>
</body>

View File

@ -168,6 +168,6 @@
<div class="toast" id="toast" role="status" aria-live="polite" hidden></div>
</div>
<script src="./script.js?v=20260429-0335" defer></script>
<script src="./script.js?v=20260507-1726" defer></script>
</body>
</html>

View File

@ -737,6 +737,20 @@
return `${year}-${pad2(monthNumber)}-${pad2(dayNumber)}T${time}`;
}
function prefersDayMonthOrder() {
return currentLang === "ar" || currentLang === "tr" || currentLang === "id";
}
function formatNumericBillBelong(year, firstPart, secondPart, time) {
const first = Number(firstPart);
const second = Number(secondPart);
if (first > 12 && second <= 12) return formatBillBelong(year, second, first, time);
if (second > 12 && first <= 12) return formatBillBelong(year, first, second, time);
return prefersDayMonthOrder()
? formatBillBelong(year, second, first, time)
: formatBillBelong(year, first, second, time);
}
function normalizeDateText(value) {
return digitMaps.reduce((textValue, [from, to]) => textValue.split(from).join(to), String(value || ""))
.replace(/&amp;/gi, "&")
@ -779,11 +793,7 @@
if (numericDate) {
const time = normalizeTime(textValue, textValue);
if (numericDate[1]) return formatBillBelong(numericDate[1], numericDate[2], numericDate[3], time);
const first = Number(numericDate[4]);
const second = Number(numericDate[5]);
const month = first > 12 && second <= 12 ? second : first;
const day = second > 12 && first <= 12 ? second : first > 12 ? first : second;
return formatBillBelong(numericDate[6], month, day, time);
return formatNumericBillBelong(numericDate[6], numericDate[4], numericDate[5], time);
}
const lowerText = textValue.toLowerCase();