Aqua-Soft Forums: Ah's Calendar - First Day Of Week - Aqua-Soft Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Ah's Calendar - First Day Of Week Rate Topic: -----

#1 User is offline   superturrican2 Icon

  • Group: Member
  • Posts: 2
  • Joined: 30-June 08

Posted 31 October 2009 - 04:53 PM

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
0

#2 User is offline   pcm Icon

  • Group: Member
  • Posts: 617
  • Joined: 02-May 05

Posted 01 December 2009 - 02:56 PM

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.

This post has been edited by pcm: 01 December 2009 - 02:58 PM

0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users