@josmangarsal/pragmatic-scheduler
Version:
React resource scheduler
11 lines (10 loc) • 485 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.dateToPosition = void 0;
var dateToPosition = function (currentDate, startDate, endDate, endWidth) {
var startEpoch = startDate.getTime(); // -> 0 px
var currentEpoch = currentDate.getTime(); // -> ? px
var endEpoch = endDate.getTime(); // -> endWidth px
return ((currentEpoch - startEpoch) * endWidth) / (endEpoch - startEpoch);
};
exports.dateToPosition = dateToPosition;