+ Fix for bug #2476

This commit is contained in:
michael 2003-11-24 23:00:56 +00:00
parent 07861bbe2b
commit 18c394efa8

View File

@ -313,7 +313,7 @@ end ;
function StrToDate(const S: string): TDateTime; function StrToDate(const S: string): TDateTime;
var var
df:string; df:string;
d,m,y:word; d,m,y,ly:word;
n,i:longint; n,i:longint;
{$IFDEF VIRTUALPASCAL} {$IFDEF VIRTUALPASCAL}
c:longint; c:longint;
@ -379,6 +379,8 @@ begin
end ; end ;
end ; end ;
// Fill in values. // Fill in values.
getLocalTime(LocalTime);
ly := LocalTime.Year;
If N=3 then If N=3 then
begin begin
y:=values[yp]; y:=values[yp];
@ -387,8 +389,7 @@ begin
end end
Else Else
begin begin
getLocalTime(LocalTime); Y:=ly;
y := LocalTime.Year;
If n<2 then If n<2 then
begin begin
d:=values[1]; d:=values[1];
@ -407,7 +408,12 @@ begin
end; end;
end; end;
if (y >= 0) and (y < 100) then if (y >= 0) and (y < 100) then
inc(y,1900); begin
ly := ly - TwoDigitYearCenturyWindow;
Inc(Y, ly div 100 * 100);
if (TwoDigitYearCenturyWindow > 0) and (Y < ly) then
Inc(Y, 100);
end;
Result := DoEncodeDate(y, m, d); Result := DoEncodeDate(y, m, d);
end ; end ;
@ -728,7 +734,10 @@ end;
{ {
$Log$ $Log$
Revision 1.1 2003-10-06 21:01:06 peter Revision 1.2 2003-11-24 23:00:56 michael
+ Fix for bug 2476
Revision 1.1 2003/10/06 21:01:06 peter
* moved classes unit to rtl * moved classes unit to rtl
Revision 1.10 2003/09/06 21:52:24 marco Revision 1.10 2003/09/06 21:52:24 marco