0

西海岸にいるクライアントがいますが、東海岸時間 (アメリカ/ニューヨーク) に基づく情報を見たいと思っています。

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());
        }
     }
   }
}

ウォールタイムを計算しようとすると、次のエラーが表示されます: Uncaught Error: Must call init with rules and zone before set time zone

4

1 に答える 1