Browse Source

* Fix bug ID #22107

git-svn-id: trunk@35467 -
michael 8 years ago
parent
commit
7ff70cbe6e
1 changed files with 14 additions and 4 deletions
  1. 14 4
      packages/rtl-objpas/src/inc/dateutil.inc

+ 14 - 4
packages/rtl-objpas/src/inc/dateutil.inc

@@ -1937,10 +1937,20 @@ Function CompareDateTime(const A, B: TDateTime): TValueRelationship;
 begin
   If SameDateTime(A,B) then
     Result:=EqualsValue
-  else If A>B then
-    Result:=GreaterThanValue
-  else
-    Result:=LessThanValue
+  else if trunc(a)=trunc(b) then
+    begin
+    if abs(frac(a))>abs(frac(b)) then 
+      result:=GreaterThanValue
+    else 
+      result:=LessThanValue;
+    end 
+  else 
+    begin
+    if a>b then 
+      result:=GreaterThanValue
+    else 
+      result:=LessThanValue;
+    end;
 end;