Problems with Calender.pm (day_of_week)

From: Johannes.Blankenstein <J.Blankenstein_at_eex.de>
Date: Wed, 27 Aug 2003 09:11:24 +0200
To: <prima_at_prima.eu.org>

Hello,

first of all .... thank you for Prima! It's realy great!

But I had big (and still have small) problems using the Calendar widget.

1. It seems that the DayOfWeek algorithm has a bug. You will find the corrected version below.
   That was the big problem! ;-)

sub day_of_week
{
   my ( $self, $day, $month, $year) = @_;
   $day++; $month++; $year += 1900;

   if ( $month < 3) {
      $month += 10;
      $year--;
   } else {
      $month -= 2; # <--- This line has been changed
   }
   my $century = int($year / 100);
   $year %= 100;
   my $dow = ( int(( 26 * $month - 2) / 10) + $day + $year + int($year / 4) +
      int($century / 4) - ( 2 * $century)) % 7;
   return ($dow < 0) ? $dow + 7 : $dow;
}

2. Now the small problem. ;-) I would like to display the week beginning with Monday as this is the
   default in Germany. Is there any chance doing that with this module?

Bye,
Hannes

-- 
Johannes Blankenstein
IT-Administrator
European Energy Exchange AG
Neumarkt 9-19, 04109 Leipzig
Deutschland / Germany
Phone	+49 (0) 341 / 2156 - 452
Fax	+49 (0) 341 / 2156 - 109
EMail: Mailto:Johannes.Blankenstein_at_eex.de
Internet http://www.eex.de
-------------------------------
Diese Email ist ausschließlich für den Adressaten bestimmt und enthält möglicherweise vertrauliche Informationen. Falls Sie diese Email irrtümlich erhalten haben, informieren Sie bitte umgehend den Absender und löschen Sie das Original. Jegliche unbefugte Verwendung dieser Mail ist unzulässig. Wie Sie wissen, können über das Internet versandte Emails leicht unter fremden Namen erstellt oder manipuliert werden. Aus diesem Grunde bitten wir um Verständnis dafür, dass wir zu Ihrem und unserem Schutz die rechtliche Verbindlichkeit der vorstehenden Erklärungen und Äußerungen ausschließen, soweit wir mit Ihnen keine anders lautenden Vereinbarungen getroffen haben. Die für die Börse geltenden Regelungen über die Verbindlichkeit von Willenserklärungen bleiben unberührt.
This message is for the designated recipient only and may contain privileged or confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the email is prohibited. As you know, e-mail sent out through the internet can be easily produced or manipulated in somebody else's name. For this reason we must ask you to understand that we exclude the binding force of the above proclamations and declaration for your as well as our own protection unless agreed otherwise with you. This shall not affect the clauses regulating the binding force of declarations of intention applicable to the Exchange.
Received on Wed 27 Aug 2003 - 09:12:01 CEST

This archive was generated by hypermail 2.2.0 : Sat 19 Mar 2011 - 18:35:04 CET