@Zoran - I thought it would be nice to have TDBDateTimePicker read and write ISO8601 date and time formats when connected to a ftString field, especially when working with a database like SQLite3 which doesn't offer a dedicated date/time data type but functions to operate on ISO string representations (cf
here). This would integrate quite seamlessly with TDBDateTimePicker itself like this (plus conversion routines, of course):
procedure TDBDateTimePicker.DataChange(Sender: TObject);
var ADateTime: TDateTime; //rkmod
begin
if (FChangingCount = 0) then begin
Inc(FDataChangeCount);
try
if Assigned(FDataLink.Field) and not FDataLink.Field.IsNull then begin
if FISOMode and (FDataLink.Field.DataType = ftString) then //rkmod
ADateTime := ISOToDateTime(FDataLink.Field.AsString)
else
ADateTime := FDataLink.Field.AsDateTime;
// Using the SetTheDateJumpMinMax procedure, instead of property
SetDateTimeJumpMinMax(ADateTime); // assignment allows
// this control to display dates from database whose value falls
// outside of MinDate and MaxDate interval.
// Note that user still cannot enter such values in the control.
end else
DateTime := NullDate;
finally
Dec(FDataChangeCount);
end;
end;
end;
//...
procedure TDBDateTimePicker.UpdateData(Sender: TObject);
begin
if Assigned(FDataLink.Field) then begin
if DateIsNull then
FDataLink.Field.AsVariant := Null
else begin
if FISOMode and (FDataLink.Field.DataType = ftString) then //rkmod
FDataLink.Field.AsString := DateTimeToISO(DateTime)
else
FDataLink.Field.AsDateTime := DateTime;
end;
end;
end;
Or it might as well be done with a descendant, of course. However, to share it this would require to move some fields and procs of TDBDateTimePicker from private section to protected, namely FDataLink, FChangingCount, FDataChangeCount and of course procs DataChange and UpdateData which would also have to be declared as virtual. I'm including my working copy of said descendant here, maybe you might want to have a look...?
Edit - sorry, I thought I
had included the attachment...