...

View Full Version : calendar bug



arturex
10-20-2006, 11:39 PM
Sorry it this is not the right place for such questions.I am trying to use a calendar in java script from ruajava.net but the calendar shows 32 day for October (Outubro). Any clue on the error ? script attached.Thanks a lot

Philip M
10-21-2006, 09:02 AM
This appears to have fixed it. Add the line shown in red.


function set_cal(show_date)
{
begin_day = new Date (show_date.getYear(),show_date.getMonth(),1);
begin_day_date = begin_day.getDay();
end_day = new Date (show_date.getYear(),show_date.getMonth()+1,1);
count_day = (end_day - begin_day)/1000/60/60/24;
count_day = Math.round(count_day);
input_table(begin_day_date,count_day);
}

This trouble seems to arise in March and October only. In all other months count_day returns an integer, i.e the number of days in the month.

arturex
10-22-2006, 04:28 PM
Thanks Philip.
Now works fine.
Have a nice Sunday!

Philip M
10-22-2006, 07:19 PM
"This trouble seems to arise in March and October only. In all other months count_day returns an integer, i.e the number of days in the month."

I should have made the point that the problem arises out of daylight saving or summer time, which adds or subtracts one hour from the month, leading to non-integer values for the calculated number of days - 31.0416 and 30.9583.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum