Code coverage report for src/flux/time.coffee

Statements: 96% (24 / 25)      Branches: 83.33% (15 / 18)      Functions: 100% (4 / 4)      Lines: 96% (24 / 25)      Ignored: none     

All files » src/flux/ » time.coffee
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53           17×   17×                     2322× 2322× 2320×   2322× 2322×     78×                    
var TimeConfig, TutorDateFormat, actions, flux, makeSimpleStore, ref, store;
 
flux = require('flux-react');
 
makeSimpleStore = require('./helpers').makeSimpleStore;
 
TutorDateFormat = "MM/DD/YYYY";
 
TimeConfig = {
  setNow: function(now, localNow) {
    if (localNow == null) {
      localNow = new Date();
    }
    return this._shiftMs = now.getTime() - localNow.getTime();
  },
  setFromString: function(txtDate, localNow) {
    var date;
    if (localNow == null) {
      localNow = new Date();
    }
    Iif (!txtDate) {
      return;
    }
    date = new Date(txtDate);
    if (isNaN(date.getTime())) {
      return typeof console !== "undefined" && console !== null ? typeof console.warn === "function" ? console.warn("Attempted to set invalid date " + txtDate + " on TimeStore") : void 0 : void 0;
    } else {
      return this.setNow(date, localNow);
    }
  },
  exports: {
    getNow: function(localNow) {
      var shift;
      if (localNow == null) {
        localNow = new Date();
      }
      shift = this._shiftMs || 0;
      return new Date(localNow.getTime() + shift);
    },
    getFormat: function() {
      return TutorDateFormat;
    }
  }
};
 
ref = makeSimpleStore(TimeConfig), actions = ref.actions, store = ref.store;
 
module.exports = {
  TimeActions: actions,
  TimeStore: store
};