Advertisement

Changed week start day to sunday

Moderators: Calcifer, slothy

Changed week start day to sunday

Postby flash » Tue Aug 29, 2006 11:35 pm

Hey my managers are extremely happy with the Calendar that they started implementing it on other sites too. Very impressive.

Then I was confronted with another problem. The previous calendar starts on Sunday and this one on Monday. Users got confused and selects one day ahead (dump people!!!). I had to fix it.

So I went ahead and looked into the code. I was thinking its going to be a night mare. But just a small change and commenting two lines made it work.

If you have the same problem find the following and comment it.

//Changed Calendar to start on Sunday
//if(dayStartOfMonth==0)dayStartOfMonth=7;
//dayStartOfMonth--;

Change the day array to have 'Sun' first, for the language you are using. i.e. var dayArray = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];
flash
 
Posts: 10
Joined: Wed Jun 07, 2006 5:55 pm

Re: Changed week start day to sunday

Postby cen17394 » Tue Sep 26, 2006 4:58 pm

Excellent Tip... I would have never figured that out. However, I think you may have commented out one too many lines. I only commented out:
//dayStartOfMonth--;
And works fine for me. I have to believe the original programmer is changing that variable from 0 to 7 for some reason, but I know nothing when it comes to java...

[quote="flash"]Hey my managers are extremely happy with the Calendar that they started implementing it on other sites too. Very impressive.

Then I was confronted with another problem. The previous calendar starts on Sunday and this one on Monday. Users got confused and selects one day ahead (dump people!!!). I had to fix it.

So I went ahead and looked into the code. I was thinking its going to be a night mare. But just a small change and commenting two lines made it work.

If you have the same problem find the following and comment it.

//Changed Calendar to start on Sunday
//if(dayStartOfMonth==0)dayStartOfMonth=7;
//dayStartOfMonth--;

Change the day array to have 'Sun' first, for the language you are using. i.e. var dayArray = ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'];[/quote]
cen17394
 
Posts: 5
Joined: Tue Sep 26, 2006 4:09 pm

Postby flash » Tue Sep 26, 2006 5:01 pm

Thats a redundant if loop. As long as it works :). I have fixed disabling the dates previous to today. Will post in that thread.
flash
 
Posts: 10
Joined: Wed Jun 07, 2006 5:55 pm


Return to Calendar script questions

Who is online

Users browsing this forum: Google [Bot] and 10 guests

cron