I have implemented a magnifyChart function where I need to add two time values. But when i do so, it is considering it as a string and concatenating it instead. Eventhough when i perform subtraction on those two values, it gives correct result. How do i get correct result on adding two date values?
function magnifyChart (timeA, timeB) {
var newTimeA;
var newTimeB;
var quarterSize = Math.floor((timeB - timeA) / 4);
logger.info("timeA", timeA); //Fri Sep 08 2017 17:45:19 GMT-0400 (EDT)
logger.info("timeB", timeB); //Sun Oct 01 2017 16:01:51 GMT-0400 (EDT)
logger.info("quarterSize", quarterSize); //495248155
newTimeA = Math.floor(parseInt(timeA) + parseInt(quarterSize));
newTimeB = Math.floor(timeB - quarterSize);
logger.info("newTimeA", newTimeA);
logger.info("newTimeB", newTimeB);//1506392863689
return [timeA + quarterSize, timeB - quarterSize];
}