Reputation: 63
I tried the same example: https://gist.github.com/rxaviers/9fec3ae0dfb7cdb0a0ce
When trying to use: en.formatDate(new Date(), { datetime: "medium" });
I get TypeError: numberSymbol is not a function
StackTrace
date.js:593 Uncaught TypeError: numberSymbol is not a functionmessage: "numberSymbol is not a function"stack: (...)get stack: function () { [native code] }set stack: function () { [native code] }__proto__: ErrordateFormatProperties @ date.js:593Globalize.dateFormatter.Globalize.dateFormatter @ date.js:1749Globalize.formatDate.Globalize.formatDate @ date.js:1820(anonymous function) @ VM1310:2InjectedScript._evaluateOn @ VM1265:883InjectedScript._evaluateAndWrap @ VM1265:816InjectedScript.evaluate @ VM1265:682
Versions: Globalize 1.0.0 and cldrjs 0.4.1
CLDR JSON data I got from https://github.com/unicode-cldr
Upvotes: 0
Views: 2402
Reputation: 173
There's no much information about your error, but I got the same error message today and figured out I was importing the javascript files out of order (yes, they have a specific order). I noticed this behavior after looking their very same example for many times: Plain Javascript Example.
The code extracted from the example:
<script src="../../dist/globalize.js"></script>
<script src="../../dist/globalize/message.js"></script>
<script src="../../dist/globalize/number.js"></script>
<script src="../../dist/globalize/plural.js"></script>
<!-- Load after globalize/number.js -->
<script src="../../dist/globalize/date.js"></script> <!-- the trick-->
<script src="../../dist/globalize/currency.js"></script>
<!-- Load after globalize/number.js and globalize/plural.js-->
<script src="../../dist/globalize/relative-time.js"></script>
Upvotes: 3