On Magento 2 (ver 2.2.5), with Google Chrome (ver 72.0) I'm getting a wired error I wasn't getting withe previous Google Chrome version (ver 71).
When I visit a product page, I get more then one Uncaught TypeError:
from the Console, which makes several JS actions failing.
For instance, the first I got is:
Uncaught TypeError: Cannot read property 'RFC_2822' of undefined
The error is referring to this bit of code:
<script>
require([
"jquery",
"jquery/ui"
], function($){
//<![CDATA[
$.extend(true, $, {
calendarConfig: {
dayNames: ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],
dayNamesMin: ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],
monthNames: ["January","February","March","April","May","June","July","August","September","October","November","December"],
monthNamesShort: ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],
infoTitle: "About the calendar",
firstDay: 0,
closeText: "Close",
currentText: "Go Today",
prevText: "Previous",
nextText: "Next",
weekHeader: "WK",
timeText: "Time",
hourText: "Hour",
minuteText: "Minute",
dateFormat: $.datepicker.RFC_2822, // << Here what's triggering the error
showOn: "button",
showAnim: "",
changeMonth: true,
changeYear: true,
buttonImageOnly: null,
buttonImage: null,
showButtonPanel: true,
showWeek: true,
timeFormat: '',
showTime: false,
showHour: false,
showMinute: false
}
});
enUS = {"m":{"wide":["January","February","March","April","May","June","July","August","September","October","November","December"],"abbr":["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]}}; // en_US locale reference
//]]>
});
</script>
The problem here is that that code comes from the Magento core, so I'm not very keen on changing it. I found that code in the following two files:
vendor/magento/module-theme/view/frontend/templates/js/calendar.phtml
vendor/magento/module-backend/view/adminhtml/templates/page/js/calendar.phtml
Now, the code (<script>....</script>
) is in the product page, while the missing object comes from the library datepicker.js which is loaded by require.js as I can see from the browser network inspector, but I guess too late to be used by that block of code.
The require.js is in the <header>
block
<script type="text/javascript" src="http://website.com/static/frontend/vendor/my-module-theme/en_GB/requirejs/require.js"></script>
Is anyone experiencing the same thing? Which one is the best way to fix it?