This should be super simple, but I cannot figure out how JavaScript function getDate
works together with Highcharts datetime on xAxis.
In my tooltip I want to display two dates in the header, like a date range for instance: 1960/1/1 - 1965/1/1.
The first date is the point.key
(which is a unix timestamp) from my data set, and I know how to set that, but the second date displayed has to be {5 years plus point.key}
.
Despite my limited knowledge of JavaScript I understand that JavaScript has a function:
function getdate() {
var tt = document.getElementById('txtDate').value;
var date = new Date(tt);
var newdate = new Date(date);
newdate.setDate(newdate.getDate() + 3);
var dd = newdate.getDate();
var mm = newdate.getMonth() + 1;
var y = newdate.getFullYear();
var someFormattedDate = mm + '/' + dd + '/' + y;
document.getElementById('follow_Date').value = someFormattedDate;
}
Is there any way I can use that function in my tooltip and generate second date in
tooltip.headerFormat: '<span style="font-size: 16px">' +
'{point.key} - {point.key + 5 years}</span><br/>';