UNPKG

@josmangarsal/pragmatic-scheduler

Version:
11 lines (10 loc) 485 B
"use strict"; 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;