#1 Re: mORMot 1 » EConvertError with message "0.42821" is a not valid timestamp » 2017-04-30 05:48:12

I will try to handle it, but I believe that ab is already being processed   smile

#2 Re: mORMot 1 » EConvertError with message "0.42821" is a not valid timestamp » 2017-04-29 05:18:04

SynVirtualDataSet.pas


+Add

  function DateTimeToNative(DataType: TFieldType; Data: TDateTime): TDateTimeRec;
  var
    TimeStamp: TTimeStamp;
  begin
    TimeStamp := DateTimeToTimeStamp(Data);
    case DataType of
      ftDate: Result.Date := TimeStamp.Date;
      ftTime: Result.Time := TimeStamp.Time;
    else
      Result.DateTime := TimeStampToMSecs(TimeStamp);
    end;
  end;

...
  ftDate, ftTime:
    if PDateTime(Data)^=0 then
      result := false else begin
      TS := DateTimeToTimeStamp(PDateTime(Data)^);
      if (TS.Time<0) or (TS.Date<=0) then
        result := false else // matches ValidateTimeStamp() expectations
        case Field.DataType of
        ftDate: PDateTimeRec(Dest)^.Date := TS.Date;
        ftTime: PDateTimeRec(Dest)^.Time := TS.Time;
        end;
    end;
  ftDateTime:   
     // Change to this.
     TDateTimeRec(Dest^) := DateTimeToNative(Field.DataType, TDateTime(Data^));
    //PDateTimeRec(Dest)^.DateTime := PDateTime(Data)^;   

Board footer

Powered by FluxBB