mirror of
https://gitlab.com/freepascal.org/fpc/pas2js.git
synced 2025-04-22 08:39:22 +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
|
||||
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;
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user