gpt4 book ai didi

javascript - 无法读取未定义的属性 'tz'- Ember 时刻时区

转载 作者:行者123 更新时间:2023-12-03 17:18:14 28 4
gpt4 key购买 nike

我有一个 Ember 应用程序,试图将时区添加到:

{
"name": "front-end",
"dependencies": {
"handlebars": "~1.3.0",
"jquery": "^1.11.1",
"ember": "1.8.1",
"ember-data": "~1.0.0-beta.14.1",
"ember-resolver": "~0.1.7",
"loader.js": "stefanpenner/loader.js#1.0.1",
"ember-cli-shims": "stefanpenner/ember-cli-shims#0.0.3",
"ember-cli-test-loader": "rwjblue/ember-cli-test-loader#0.0.4",
"ember-load-initializers": "stefanpenner/ember-load-initializers#0.0.2",
"ember-qunit": "0.1.8",
"ember-qunit-notifications": "0.0.4",
"qunit": "~1.17.1",
"bootstrap": "~3.3.2",
"ember-simple-auth": "0.7.3",
"jquery-autosize": "~1.18.12",
"moment-timezone": "~0.3.0"
}
}

我在Brocfile.js中的这一行加载js文件:
app.import('bower_components/moment-timezone/builds/moment-timezone-with-data-2010-2020.min.js');

当我启动ember服务器时,甚至在我使用任何自定义脚本调用moment之前,我都会收到以下错误:
 Uncaught TypeError: Cannot read property 'tz' of undefined

有人可以告诉我加载矩时区的正确方法吗?
谢谢!

最佳答案

您需要先导入Moment,然后再导入Moment时区。

参见http://momentjs.com/timezone/docs/

关于javascript - 无法读取未定义的属性 'tz'- Ember 时刻时区,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28531167/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com