我正在努力将Moment Timezone实现到Django应用程序中,以便纠正从不同时区访问它的用户,并且在通过Require.js导入文件时遇到错误.moment.js,moment-timezone.js和moment-timezone-data.js都在加载,但是当我的脚本运行并尝试启动它们时,moment-timezone.js和moment-timezone-data.js会抛出Uncaught TypeErrors.
我的moment-timezone-data.js文件是从Moment.js时区数据生成器复制粘贴的,看起来像这样(虽然有更多的时区):
moment.tz.add({
"zones": {
"America/New_York": [
"-4:56:2 - LMT 1883_10_18_12_3_58 -4:56:2",
"-5 US E%sT 1920 -5",
"-5 NYC E%sT 1942 -5",
"-5 US E%sT 1946 -5",
"-5 NYC E%sT 1967 -5",
"-5 US E%sT"
]
},
"rules": {
"US": [
"1918 1919 2 0 8 2 0 1 D",
"1918 1919 9 0 8 2 0 0 S",
"1942 1942 1 9 7 2 0 1 W",
"1945 1945 7 14 7 23 1 1 …Run Code Online (Sandbox Code Playgroud)