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