Date picker not displaying year properly with Fluent Form Pro Addon
-
I am using the below code for date picker condition:
{
maxDate: new Date(new Date().getFullYear() – 18, 11, 31), // 18 years ago from today
allowInput: true,
dateFormat: “m/d/Y”,
onReady: function(selectedDates, dateStr, instance) {// Set the width, top position, and padding for the Flatpickr calendar directly via JavaScript
//I use this for the date picker issue.
instance.calendarContainer.style.width = “450px”; // Adjust as needed
instance.calendarContainer.style.padding = “10px”; // Add padding around the calendar
instance.calendarContainer.style.zIndex = “9999”; // Ensure it’s above other elements
instance.calendarContainer.style.position = “absolute”; // Ensure proper positioning// Add event listener to format input as the user types instance.input.addEventListener('input', function(e) { let value = instance.input.value.replace(/[^\d]/g, ''); // Remove non-digits if (value.length > 8) { value = value.slice(0, 8); } let formattedValue = ''; if (value.length > 2) { formattedValue += value.slice(0, 2) + '/'; value = value.slice(2); } if (value.length > 2) { formattedValue += value.slice(0, 2) + '/'; value = value.slice(2); } formattedValue += value; instance.input.value = formattedValue; }); }
}
The year isn’t showing nonetheless. Need help
The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.