From 37fa159874238793e99971de4f0e7b5e50840c86 Mon Sep 17 00:00:00 2001 From: Bart <9132501-flyingsheep@users.noreply.gitlab.com> Date: Tue, 2 Aug 2022 22:57:09 +0200 Subject: [PATCH] TDateEdit: use 0.1 msec as epsilon value when comparing TDateTime values. --- lcl/editbtn.pas | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lcl/editbtn.pas b/lcl/editbtn.pas index 4417c0b71d..621887a0f8 100644 --- a/lcl/editbtn.pas +++ b/lcl/editbtn.pas @@ -921,6 +921,9 @@ implementation {$R lcl_edbtnimg.res} +const + DTEpsilon = Double(1.0)/(24*3600*1000*10); //0.1 millisec (0.000000001157407407); + { TEditSpeedButton } procedure TEditSpeedButton.GlyphChanged(Sender: TObject); @@ -2010,17 +2013,17 @@ end; function TDateEdit.IsLimited: Boolean; begin - Result := (CompareValue(FMinDate, FMaxDate, 1E-9) = LessThanValue); + Result := (CompareValue(FMinDate, FMaxDate, DTEpsilon) = LessThanValue); end; function TDateEdit.GetMaxDateStored: Boolean; begin - Result := not SameValue(FMaxDate, Double(0.0), 1E-9); + Result := not SameValue(FMaxDate, Double(0.0), DTEpsilon); end; function TDateEdit.GetMinDateStored: Boolean; begin - Result := not SameValue(FMinDate, Double(0.0), 1E-9); + Result := not SameValue(FMinDate, Double(0.0), DTEpsilon); end; function TDateEdit.GetDate: TDateTime;