Marla: fehlende Tage in Javascript

Beitrag lesen

Hi,

irgendwie bekomm ich es nicht gebacken, mit JS eine Liste der Tage ab 2009-07-01 auszugeben. Im Beispiel fehlt dann z.B. 2010-03-28

[code lang=javascript]
function d2h(date) {
var y=date.getFullYear();
var m=correct_month(date.getMonth());
var d=correct_day(date.getDate());
return y + "-" + m + "-" + d;
}
function h2d(hyphen) {
return (new Date(hyphen.replace(/-/g, "/"))).getTime();
}
function correct_month(month)
{
month++;
if(month>12)
month=1;
if(month<10)
month="0"+month;
return month;
}
function correct_day(day)
{
day=0+day;
if(day<10)
day="0"+day;
return day;
}
function getAllDates() {
start = (new Date(min_date.replace(/-/g, "/"))).getTime();
var dates = [];
var current = start_date;
var dates = [];
z=0;
var cdays=n_days;
while(cdays>0) {
z++;
var tmp = new Date(current);
//dates.push(d2h(tmp));
document.writeln(d2h(tmp)+"<br>");
current = (new Date(current + day_length)).getTime();
cdays--;
}
return dates;
}
var min_date = "2009-07-01";
var start_date = h2d(min_date);
var n_days=500;
var day_length = 86400000;
getAllDates();
/code]

Bitte um Rat