IDEIntf: TDateTimePropertyEditor now tries date+time, date only and time only

git-svn-id: trunk@11798 -
This commit is contained in:
mattias 2007-08-12 11:59:49 +00:00
parent 7d0d0743fd
commit dcd6a94ad3

View File

@ -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;