Ah's Calendar - First Day Of Week

Hi all !

I'm trying to translate AH's Calendar to Italian. I have already changed the bitmaps, but I have an issue with the code.

I want to change the first day of the week, I tried to modify something (such as var sday = CurrentMonth.getDay () -1;) but the change does not work for months beginning on Saturday!

someone who know how to change or edit the first day of the week to fit the European system? (first day = Monday)

very thanks

#532106

That is a easy change.

First you need a new header (days.png) for the days of the week.

Second you need to change the javascript code to reflect this request.

In the BuildCalendarForDay function, you'll see a variable sday (Start Date)

original code

var sday = CurrentMonth.getDay(); //Javascript returns 0-6 where 0 means Sunday since it starts on sunday.

What you want is to shift it so that Moday is your start

var sday = CurrentMonth.getDay()-1; //1 now is 0 (making monday 0 the start)

BUT now Sunday is -1 which makes no sense, you need to make it 6. The last value.

if (sday < 0)

sday = 6; //Now sunday will be the last value, 6

Here is the entire code with no comments:

var sday = CurrentMonth.getDay()-1;

if (sday < 0)

sday = 6;

This should do it.. Have a nice day.

Sorry for the delay, I haven't been following the forums much.

But I always check my emails. (Which you sent me, Thanks)

Figured I'd post the info here too.

#532910