function jumpToDevotional() {
const dayInput = document.getElementById(‘day-number’);
const dayNumber = dayInput.value.trim(); // Get and trim the value
const yearNumber = document.getElementById(‘year-number’).value; // Get selected year
const errorMessage = document.getElementById(‘error-message’);// Reset error message
errorMessage.style.display = ‘none’;// Convert to number and floor it (round down to whole number)
const dayNum = Number(dayNumber);
const flooredDay = Math.floor(dayNum || 0); // Use 0 if NaN or empty// Validation on the input and floored value
if (dayNumber === ” || isNaN(dayNum) || flooredDay 366) {
errorMessage.style.display = ‘block’; // Show error
dayInput.focus(); // Focus back on input
return; // Prevent redirect
}// If valid, construct URL and redirect
const postUrl = `https://lifetransforminggospel-web.org/cn/${yearNumber}年-第${flooredDay}天`; // Replace with your actual domain
window.location.href = postUrl;
}