0

我尝试了相同的示例:https ://gist.github.com/rxaviers/9fec3ae0dfb7cdb0a0ce

尝试使用时:en.formatDate(new Date(), { datetime: "medium" });我得到TypeError: numberSymbol is not a function

堆栈跟踪

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

版本: 全球化 1.0.0cldrjs 0.4.1

我从https://github.com/unicode-cldr获得的 CLDR JSON 数据

4

1 回答 1

3

没有太多关于您的错误的信息,但我今天收到了相同的错误消息,并发现我正在乱序导入 javascript 文件(是的,它们有特定的顺序)。在多次查看他们的相同示例后,我注意到了这种行为:Plain Javascript 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>
于 2015-06-15T23:25:35.557 回答