mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 11:39:19 +02:00
IDEIntf: TDateTimePropertyEditor now tries date+time, date only and time only
git-svn-id: trunk@11798 -
This commit is contained in:
parent
7d0d0743fd
commit
dcd6a94ad3
@ -4250,9 +4250,35 @@ end;
|
|||||||
procedure TDateTimePropertyEditor.SetValue(const Value: string);
|
procedure TDateTimePropertyEditor.SetValue(const Value: string);
|
||||||
var
|
var
|
||||||
DT: TDateTime;
|
DT: TDateTime;
|
||||||
|
ok: Boolean;
|
||||||
begin
|
begin
|
||||||
if Value = '' then DT := 0.0
|
if Value = '' then DT := 0.0
|
||||||
else DT := StrToDateTime(Value);
|
else begin
|
||||||
|
ok:=false;
|
||||||
|
// first try date+time
|
||||||
|
try
|
||||||
|
DT := StrToDateTime(Value);
|
||||||
|
ok:=true;
|
||||||
|
except
|
||||||
|
end;
|
||||||
|
// then try date without time
|
||||||
|
if not ok then
|
||||||
|
try
|
||||||
|
DT := StrToDate(Value);
|
||||||
|
ok:=true;
|
||||||
|
except
|
||||||
|
end;
|
||||||
|
// then try time without date
|
||||||
|
if not ok then
|
||||||
|
try
|
||||||
|
DT := StrToTime(Value);
|
||||||
|
ok:=true;
|
||||||
|
except
|
||||||
|
end;
|
||||||
|
// if all fails then raise exception
|
||||||
|
if not ok then
|
||||||
|
StrToDateTime(Value);
|
||||||
|
end;
|
||||||
SetFloatValue(DT);
|
SetFloatValue(DT);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user