mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-07 12:20:25 +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);
|
||||
var
|
||||
DT: TDateTime;
|
||||
ok: Boolean;
|
||||
begin
|
||||
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);
|
||||
end;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user