Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
var findPeriodicalIntervalFor = function(tDate, sDate, eDate, pDuration) {
var period = pDuration.milliseconds();
var difference = date.subtract(tDate, sDate).toMilliseconds();
var remainder = difference % period;
var offset = difference - remainder;
offset += remainder >= 0 ? 0 : - period;
var result = {};
result.sDate = date.addMilliseconds(sDate, offset);
result.eDate = date.addMilliseconds(eDate, offset);
return result;
}
.orderBy(function (a, b) {
if(util.isDate(a.id)){
return (
(date.subtract(new Date(a.id), new Date(b.id)).toMilliseconds()<0)
? -1
: 1
)
}
if(util.isString(a.id)){
String.naturalCompare(a.id.toLowerCase(),b.id.toLowerCase())
}
return a.id - b.id
})
.get();
function(a,b){
return date.subtract(new Date(a.timeStamp), new Date(b.timeStamp)).toMilliseconds();
})
return this;
var isInInterval = function(tDate, sDate, eDate) {
return date.subtract(tDate, sDate).toMilliseconds() >= 0 &&
date.subtract(tDate, eDate).toMilliseconds() < 0;
}
"Z-A": function(a, b) {
return date.subtract(new Date(b), new Date(a)).toMilliseconds();
}
}
}
if (!isInInterval(rDatePoint, fromDate, toDate)) {
rDatePoint = toDate;
}
timePointsSet.add(lDatePoint.getTime());
timePointsSet.add(rDatePoint.getTime());
if (indicator.distribution) {
var distr = indicator.distribution;
var i = 0;
var iDate;
do {
var fromStart = new Duration(distr[i].fromStart).milliseconds();
iDate = date.addMilliseconds(sDate, fromStart);
} while(++i < distr.length && date.subtract(iDate, lDatePoint).toMilliseconds() <= 0);
i--;
for(; i < distr.length; i++) {
var fromStart = new Duration(distr[i].fromStart).milliseconds();
iDate = date.addMilliseconds(sDate, fromStart);
if (isInInterval(iDate, lDatePoint, rDatePoint)) {
timePointsSet.add(iDate.getTime());
} else {
break;
}
}
}
if (pDuration) {
var period = pDuration.milliseconds();
sDate = date.addMilliseconds(sDate, period);
eDate = date.addMilliseconds(eDate, period);
Handlebars.registerHelper('differenceBeetwenDates', (firstDate, secondDate) => {
let seconds = DateTime.subtract(secondDate, firstDate).toSeconds();
let string = '';
let sec_num = parseInt(seconds, 10);
let hours = Math.floor(sec_num / 3600);
let minutes = Math.floor((sec_num - (hours * 3600)) / 60);
seconds = sec_num - (hours * 3600) - (minutes * 60);
if (hours > 0)
string += hours + ' hours, ';
if (minutes > 0)
string += minutes + ' minutes, ';
if (seconds > 0)
string += seconds + ' seconds';
if (string.length == 0)
string = 'Time not available';
return string;
})
var isInInterval = function(tDate, sDate, eDate) {
return date.subtract(tDate, sDate).toMilliseconds() >= 0 &&
date.subtract(tDate, eDate).toMilliseconds() < 0;
}
"Z-A": function(a,b){
return date.subtract(new Date(b), new Date(a)).toMilliseconds();
}
}