I’m working on a Magento website with a date picker component. When users have their device language set to English (Hong Kong SAR China), the calendar widget defaults to January 1st, 1970 instead of today’s date. This issue only happens in the Internet Explorer browser.
The date picker should display the current date by default, but instead, it shows the Unix epoch time. I’ve tested this with other language settings, and it works fine. The problem seems specific to the English Hong Kong locale combined with IE.
Has anyone encountered this localization issue before? I need to find a way to force the calendar to show today’s date regardless of the locale settings. Any suggestions on how to handle this date initialization problem in Magento?
Hmm, that’s interesting - does this happen on all IE versions or just specific ones? Also curious if you’ve tried clearing the browser cache or testing in incognito mode? Sometimes IE caches weird locale data. What version of Magento are you running btw?
sounds like a timezone bug in ie. set the datepicker’s timezone to hk before you init it. had the same prob with singapore english locale - fixed it by manually adding the timezone offset in the js config. also check if your magento’s en_hk locale files are set up right - they’re sometimes missing or corrupted.
I encountered a similar issue with Magento’s date picker on Asian locales. The problem arises when JavaScript’s date parsing does not align with what the locale anticipates. What resolved it for me was directly using JavaScript’s new Date() constructor instead of allowing it to parse locale-specific formats. In your template, ensure the date picker defaults to today’s date. Additionally, implement a fallback that checks if the date defaults to the Unix epoch; if so, replace it with the current date. This solution proved effective across various IE versions and locale configurations.