When running the small html file below I see the following console log error:
moment.js:13 Uncaught TypeError: Cannot read property 'defineLocale' of undefined
at moment.js:13
at moment.js:9
at moment.js:10
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="../scripts/libraries/moment.js"></script>
</head>
<body>
<script>
var now = moment()
console.log(now);
</script>
</body>
</html>
I have also tried replacing the reference to the local library with this CDN link: https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/locale/af.js
Anyone know what this error is?
It seems to be a problem with your version of moment.js
. The script that you have is only for locale
, you need to include the moment.js
script:
https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.js
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.js"></script>
</head>
<body>
<script>
var now = moment()
console.log(typeof moment.defineLocale)
</script>
</body>
</html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With