* Accept native Javascript Date, (adapted) patch from Bruno

This commit is contained in:
michael 2020-07-09 09:57:53 +00:00
parent d744f40921
commit 50ce665a76
2 changed files with 13 additions and 2 deletions

View File

@ -3932,6 +3932,8 @@ begin
end
else if IsNumber(aValue) then
Result:=TDateTime(AValue)
else if IsDate(aValue) then
Result:=JSDateToDateTime(TJSDate(aValue));
end;
function TDataSet.ConvertDateTimeToNative(aField: TField; aValue : TDateTime) : JSValue;

View File

@ -657,9 +657,18 @@ function TDateTimeFieldComparer.Compare(RowIndex: Integer; aValue: JSValue): Int
var
D1,D2 : TDateTime;
Function ToDate(v: JSValue) : TDateTime;
begin
if IsDate(v) then
Result:= JSDateToDateTime(TJSDate(v))
else
Result:=Dataset.ConvertDateTimeField(String(v),Self.Field);
end;
begin
D1:=Dataset.ConvertDateTimeField(String(GetFieldValue(Rowindex)),Self.Field);
D2:=Dataset.ConvertDateTimeField(String(aValue),Self.Field);
D1:=ToDate(GetFieldValue(RowIndex));
D2:=ToDate(aValue);
Result:=Round(D1-D2);
end;