function Validaattori_1v iikko(source,ar gs)
{
var star_tdate;
var end_date;
start_date = document.all("L aina_alku").val ue;
end_date = document.all("L aina_loppu").va lue;
var start_day;
var end_day;
var start_month;
var end_month;
var start_year;
var end_year;
start_day = start_date.subs tring(0,2);
end_day = end_date.substr ing(0,2);
start_month = start_date.subs tring(3,5);
end_month = end_date.substr ing(3,5);
start_year = start_date.subs tring(6,10);
start_year = end_date.substr ing(6,10);
var startingdate = new Date();
startingdate.se tMonth(parseInt (start_month)-1,parseInt(star t_day));
startingdate.se tYear(parseInt( start_year));
var endingdate = new Date();
date_loppu.setM onth(parseInt(e nd_month)-1,parseInt(end_ day));
date_loppu.setY ear(parseInt(en d_year));
var dif_indays = Math.round( (endingdate.get Time() -
startingdate.ge tTime()) / (1000 * 60 * 60 * 24) );
// For debug
document.writel n(start_date + " " + end_date);
document.writel n(startingdate + " " + endingdate);
if ( (erotus_paivia < 7) && (erotus_paivia > 0) )
args.IsValid = true;
else
args.IsValid = false;
}
So Im using this code with ASP.net pages as clientvalidatio n function.
I don't think that has anything to do with the actual problem though.
So if i pick start_date of lets say "29.04.2004 " and end_date
"06.05.2004 " I will get this as debug info:
29.04.2004 06.05.2004 Thu Apr 29 12:54:05 UTC+0300 2004 Thu May 6
12:54:05 UTC+0300 2004
Everything seems to be working just fine, but...
If i pick end_date of "08.04.2004 " (or "09.05.2004 ") i get this:
29.04.2004 08.05.2004 Thu Apr 29 12:55:42 UTC+0300 2004 Fri Apr 30
12:55:42 UTC+0300 2004
End date is completely wrong.
Then again if i pick "10.05.2004 " i get:
..04.2004 10.05.2004 Thu Apr 29 12:56:36 UTC+0300 2004 Mon May 10
12:56:36 UTC+0300 2004
So those 2 dates 8 and 9.5 are giving all wrong dates and Im all out
of answers. Haven't found that error with any other dates yet.
{
var star_tdate;
var end_date;
start_date = document.all("L aina_alku").val ue;
end_date = document.all("L aina_loppu").va lue;
var start_day;
var end_day;
var start_month;
var end_month;
var start_year;
var end_year;
start_day = start_date.subs tring(0,2);
end_day = end_date.substr ing(0,2);
start_month = start_date.subs tring(3,5);
end_month = end_date.substr ing(3,5);
start_year = start_date.subs tring(6,10);
start_year = end_date.substr ing(6,10);
var startingdate = new Date();
startingdate.se tMonth(parseInt (start_month)-1,parseInt(star t_day));
startingdate.se tYear(parseInt( start_year));
var endingdate = new Date();
date_loppu.setM onth(parseInt(e nd_month)-1,parseInt(end_ day));
date_loppu.setY ear(parseInt(en d_year));
var dif_indays = Math.round( (endingdate.get Time() -
startingdate.ge tTime()) / (1000 * 60 * 60 * 24) );
// For debug
document.writel n(start_date + " " + end_date);
document.writel n(startingdate + " " + endingdate);
if ( (erotus_paivia < 7) && (erotus_paivia > 0) )
args.IsValid = true;
else
args.IsValid = false;
}
So Im using this code with ASP.net pages as clientvalidatio n function.
I don't think that has anything to do with the actual problem though.
So if i pick start_date of lets say "29.04.2004 " and end_date
"06.05.2004 " I will get this as debug info:
29.04.2004 06.05.2004 Thu Apr 29 12:54:05 UTC+0300 2004 Thu May 6
12:54:05 UTC+0300 2004
Everything seems to be working just fine, but...
If i pick end_date of "08.04.2004 " (or "09.05.2004 ") i get this:
29.04.2004 08.05.2004 Thu Apr 29 12:55:42 UTC+0300 2004 Fri Apr 30
12:55:42 UTC+0300 2004
End date is completely wrong.
Then again if i pick "10.05.2004 " i get:
..04.2004 10.05.2004 Thu Apr 29 12:56:36 UTC+0300 2004 Mon May 10
12:56:36 UTC+0300 2004
So those 2 dates 8 and 9.5 are giving all wrong dates and Im all out
of answers. Haven't found that error with any other dates yet.
Comment