Browse Source

* Fix dayOfWeek for dates < 0 (bug ID #23144)

git-svn-id: trunk@22679 -
michael 12 years ago
parent
commit
9d6b4aa946
1 changed files with 4 additions and 2 deletions
  1. 4 2
      rtl/objpas/sysutils/dati.inc

+ 4 - 2
rtl/objpas/sysutils/dati.inc

@@ -220,8 +220,10 @@ end ;
 
 function DayOfWeek(DateTime: TDateTime): integer;
 begin
-  Result := 1 + (Abs(Trunc(DateTime) - 1) mod 7);
-end ;
+  Result := 1 + ((Trunc(DateTime) - 1) mod 7);
+  If (Result<=0) then
+    Inc(Result,7);
+end;
 
 {   Date returns the current Date   }