var now = new Date(); var daysOfYear = []; for (var d = new Date(2012, 0, 1); d <= now; d.setDate(d.getDate() + 1)) { daysOfYear.push(new Date(d)); }