DaysBetween produces wrong results for dates before TDateTime(0)
Original Reporter info from Mantis: Fr0sT
-
Reporter name:
Original Reporter info from Mantis: Fr0sT
- Reporter name:
Description:
Attached test produces the following output:
20.12.1899 9
21.12.1899 8
22.12.1899 7
23.12.1899 6
24.12.1899 5
25.12.1899 4
26.12.1899 3
27.12.1899 2
28.12.1899 1 ===> bug!
29.12.1899 1
30.12.1899 0
31.12.1899 1
The same code under Delphi produces numbers from 10 to 1 (2 for 28.12.1899 and so forth).
Steps to reproduce:
procedure Test;
var
dt: TDateTime;
i: Integer;
begin
for i := 0 to 11 do
begin
dt := EncodeDate(1899, 12, 20 + i);
WriteLn(DateTimeToStr(dt) + ' ' + IntToStr(DaysBetween(dt, 0)));
end;
end;
Mantis conversion info:
- Mantis ID: 37361
- OS: Windows
- OS Build: 7
- Platform: x64
- Version: 3.3.1
- Fixed in revision: 45793 (#3b608903)
- Monitored by: » Fr0sT (Fr0sT)