From 0fbba1a7268639b4e9c0430c41bd588fa733458f Mon Sep 17 00:00:00 2001 From: Bart <9132501-flyingsheep@users.noreply.gitlab.com> Date: Wed, 3 Aug 2022 00:15:46 +0200 Subject: [PATCH] TDateEdit: adjust Date if necessary when setting MinDate/MaxDate. --- lcl/editbtn.pas | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lcl/editbtn.pas b/lcl/editbtn.pas index 1c40a9af8a..be37a4ccf8 100644 --- a/lcl/editbtn.pas +++ b/lcl/editbtn.pas @@ -2007,6 +2007,8 @@ begin CheckRange(AValue, MinDateTime, MaxDateTime); if FMaxDate = AValue then Exit; FMaxDate := AValue; + if IsLimited and not IsNullDate(FDate) and (FDate > FMaxDate) then + SetDate(FMaxDate); end; procedure TDateEdit.SetMinDate(AValue: TDateTime); @@ -2014,6 +2016,8 @@ begin CheckRange(AValue, MinDateTime, MaxDateTime); if FMinDate = AValue then Exit; FMinDate := AValue; + if IsLimited and not IsNullDate(FDate) and (FDate < FMinDate) then + SetDate(FMinDate); end; function TDateEdit.IsLimited: Boolean;