mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-02 15:52:05 +02:00
+ Fixed incMonth so it truncates on the number of days in the target month
git-svn-id: trunk@3864 -
This commit is contained in:
parent
dc0e8428a6
commit
85017f4139
@ -263,7 +263,7 @@ end;
|
|||||||
|
|
||||||
function IncMonth(const DateTime: TDateTime; NumberOfMonths: integer = 1 ): TDateTime;
|
function IncMonth(const DateTime: TDateTime; NumberOfMonths: integer = 1 ): TDateTime;
|
||||||
var
|
var
|
||||||
Year, Month, Day: word;
|
Year, Month, Day : word;
|
||||||
S : Integer;
|
S : Integer;
|
||||||
begin
|
begin
|
||||||
If NumberOfMonths>=0 then
|
If NumberOfMonths>=0 then
|
||||||
@ -279,8 +279,8 @@ begin
|
|||||||
Inc(Year, S);
|
Inc(Year, S);
|
||||||
end;
|
end;
|
||||||
Inc(Month); { Months from 1 to 12 }
|
Inc(Month); { Months from 1 to 12 }
|
||||||
if (Month = 2) and (IsLeapYear(Year)) and (Day > 28) then
|
If (Day>MonthDays[IsLeapYear(Year)][Month]) then
|
||||||
Day := 28;
|
Day:=MonthDays[IsLeapYear(Year)][Month];
|
||||||
result := Frac(DateTime) + DoEncodeDate(Year, Month, Day);
|
result := Frac(DateTime) + DoEncodeDate(Year, Month, Day);
|
||||||
end ;
|
end ;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user