I'm trying to create an array of date objects starting from a certain date up till today.
Here's the code I have:
var beginning = new Date("04,06,2013");
var dates = [];
var today = new Date();
while (beginning < today){
    var x = beginning; 
    console.log(x);
    dates.push(x);
    beginning.setDate(beginning.getDate()+1)
}
for (var i in dates) {
  console.log(dates[i]);
}
In the while loop I see the correct dates incrementing but when I print out the dates in the array at the last for loop I see all the dates that are pushed being today's date.
Any ideas?
 
     
    