mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-08-18 16:49:05 +02:00
* Accept native Javascript Date, (adapted) patch from Bruno
This commit is contained in:
parent
d744f40921
commit
50ce665a76
@ -3932,6 +3932,8 @@ begin
|
|||||||
end
|
end
|
||||||
else if IsNumber(aValue) then
|
else if IsNumber(aValue) then
|
||||||
Result:=TDateTime(AValue)
|
Result:=TDateTime(AValue)
|
||||||
|
else if IsDate(aValue) then
|
||||||
|
Result:=JSDateToDateTime(TJSDate(aValue));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TDataSet.ConvertDateTimeToNative(aField: TField; aValue : TDateTime) : JSValue;
|
function TDataSet.ConvertDateTimeToNative(aField: TField; aValue : TDateTime) : JSValue;
|
||||||
|
@ -657,9 +657,18 @@ function TDateTimeFieldComparer.Compare(RowIndex: Integer; aValue: JSValue): Int
|
|||||||
var
|
var
|
||||||
D1,D2 : TDateTime;
|
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
|
begin
|
||||||
D1:=Dataset.ConvertDateTimeField(String(GetFieldValue(Rowindex)),Self.Field);
|
D1:=ToDate(GetFieldValue(RowIndex));
|
||||||
D2:=Dataset.ConvertDateTimeField(String(aValue),Self.Field);
|
D2:=ToDate(aValue);
|
||||||
Result:=Round(D1-D2);
|
Result:=Round(D1-D2);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user