Click here to Skip to main content
15,890,186 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Ok, the last question (promise) about the calendar at http://testingbar.atspace.com/index2.htm[^]

August starts with a Sunday. If you press "Nästa" until you reach "Augusti", then you'll notice that the number 1 is not visible. It is the same with every month that begins with a Sunday. However, if the month starts with another day in the weekend it looks correct. How to correct this? :confused:
Posted

Where did you get this calendar and why are you asking us to rewrite it for you ? The answer is obviously to look through the code, work out what the bug is, and fix it. Could it be a rounding error ?
 
Share this answer
 
I think it's a problem with the Date.getDay() function. I believe it returns 0 for sundays which may be throwing your following logic off.

I had a quick look and found this:
Line 89:
firstDay = firstDate.getDay() + 0;
Ignore the fact that +0 is doing absolutely nothing useful. All you need is a little condition on the line underneath it like:
firstDay = ( firstDay == 0 ) ? 7 : firstDay;
 
Share this answer
 
v4

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900