* Better handling of empty dates

This commit is contained in:
Michaël Van Canneyt 2024-01-14 14:48:01 +01:00
parent f6aa05353b
commit 0cffa26111

View File

@ -878,25 +878,22 @@ function TCustomDBBootstrapTableWidget.MakeDateTimeRenderCol(aCol: TBootstrapTab
DT : TDateTime;
begin
if aTableCol.Formatting = '' then
if IsNull(Data) or isUndefined(Data) then
Result:=''
else if aTableCol.Formatting = '' then
Result := String(Data)
else
begin
if IsNull(Data) then
if Data is TJSDate then
Dt:=JSDateToDateTime(TJSDate(Data))
else if isString(Data) then
Dt:=ISO8601ToDate(String(Data),False)
else
Dt:=0;
if Dt<=100 then
Result:=''
else
begin
if Data is TJSDate then
Dt:=JSDateToDateTime(TJSDate(Data))
else if isString(Data) then
Dt:=ISO8601ToDate(String(Data),False)
else
Dt:=0;
if Dt<=100 then
Result:=''
else
Result := FormatDateTime(aTableCol.Formatting, DT)
end;
Result := FormatDateTime(aTableCol.Formatting, DT)
end;
if aTableCol.ExtraAttributes <> '' then
Result := Format('<span %s>%s</span>', [ReplaceMoustache(row, aTableCol.ExtraAttributes), Result]);