我有一个客户在西海岸,但想查看基于东海岸时间(美国/纽约)的信息。
我正在尝试使用 WallTime 库:https ://github.com/sproutsocial/walltime-js
define(function(require) {
var _ = require('underscore'),
Backbone = require('backbone'),
WallTime = require('walltime');
require('backbone.relational');
require('walltime-data');
var DateRange = Backbone.RelationalModel.extend({
initialize: function(opts) {
var self = this,
type = (opts && opts.type) || "today";
if(type == "custom") {
var undef = _.isUndefined(opts.start) && _.isUndefined(opts.end);
if(undef)
throw "'start' and/or 'end' date not present in options for type: custom";
}
function getNycDate(date){
var someUTCDate = new Date(date.getTime()),
nycWallTime = WallTime.UTCToWallTime(someUTCDate, "America/New_York");
return nycWallTime;
}
function setup() {
var now = getNycDate(new Date());
}
}
}
}
尝试计算 walltime 时出现以下错误:未捕获的错误:必须在设置时区之前使用规则和区域调用 init