HTML `<input type='date'>` value not formatted correctly in Firefox with locale settings
I'm getting frustrated with After trying multiple solutions online, I still can't figure this out... I'm working on a web form that includes a date input using `<input type='date'>` to allow users to select a date. The issue arises when users from different locales are accessing the form in Firefox. For instance, when a user selects a date like '2023-10-10', the input displays it correctly. However, when I try to set the value programmatically using JavaScript, it doesn't seem to reflect correctly in the UI, and instead, I see the value as 'Invalid Date'. I have tried the following code to set the date: ```javascript const dateInput = document.querySelector('#myDate'); dateInput.value = '10/10/2023'; // Trying to set in MM/DD/YYYY format ``` However, this results in an error. I also attempted to format it as follows, thinking it might be a formatting issue: ```javascript dateInput.value = new Date('2023-10-10').toISOString().split('T')[0]; ``` Yet, the same issue persists, and the date input remains empty or shows 'Invalid Date'. I've checked the Firefox version, and it's the latest (118.0). This issue doesn't occur in Chrome or Edge, where the same code works perfectly. I've also ensured that the date locale settings in my browser are set correctly, but it seems that Firefox handles the date formatting differently. Has anyone encountered this issue or can provide insights on how to ensure that the date is formatted correctly across different browsers, specifically in Firefox? Any suggestions on how to programmatically set the value without running into these locale-related issues would be greatly appreciated! I'm working on a API that needs to handle this. Am I missing something obvious? I've been using Javascript for about a year now. Any examples would be super helpful.