The parseDate function below results in odd date outputs, especially when using .getFullYear(). Why is this happening and how do I correct the code below?
const parseDate = (epochDate) => {
var date = new Date(epochDate * 1000);
var day = date.getDate();
var month = date.getMonth();
var year = date.getFullYear();
var fullDate = day + "-" + (month + 1) + "-" + year;
console.log("date", epochDate)
}
parseDate(412992000000) //output: 12-3-15057
parseDate(-232848000000) //output: 4-5--5409