I'm trying to init a var in JS with date from another JS object but whatever i am trying getting reference to the old object (pointer) and I need it not to change.
var lastActionDate = new Date(mainLastActionDate);
var nowDate = new Date();
var tmpLastActionDate = lastActionDate;
if ((tmpLastActionDate.setDate(tmpLastActionDate.getDate() + 7)) > nowDate)
The last line is the problematic line. I thought that lastActionDate should not be changed and i need it to stay with the old date, but it changes with tmpLastActionDate and i am guessing because it is a pointer.
How can one set a date object by value instead of reference?