Exceção ao converter String em TDateTime em um TCriteria.List .
trecho do código fonte:
na função que uso
var
ACriteria: TCriteria;
AManager: TObjectManager;
begin
Result := nil;
AManager := GetNewManager;
ACriteria := AManager.CreateCriteria(TUsuarioEmpresa);
With ACriteria do begin
CreateAlias('Usuario', 'Usuario');
CreateAlias('EmpresaAcesso', 'EmpresaAcesso');
Add(TLinq.Eq('Usuario.Login', _ALogin));
Add(TLinq.Eq('Usuario.Senha', TFuncoes.getFuncoes.Criptar(_ASenha)) or TLinq.Eq('Usuario.Senha', _ASenha));
AddOrder(TOrder.Asc('EmpresaAcesso.Chave'));
end;
Result := ACriteria.List<TUsuarioEmpresa>;
end;
Exceção dentro da Unit Aurelius.Global.Utils;
Segue função onde ocorre:
unit Aurelius.Global.Utils;
class function TUtils.ISOToDateTime(const Value: string): TDateTime;
var
Fmt: TFormatSettings;
begin
if Value = '' then Exit(0);
Fmt.ShortDateFormat := 'YYYY-mm-dd';
Fmt.DateSeparator := '-';
Fmt.ShortTimeFormat := 'hh:nn:ss.zzz';
Fmt.TimeSeparator := ':';
Fmt.DecimalSeparator := '.';
Fmt.TimeAMString := 'AM';
Fmt.TimePMString := 'PM';
Result := StrToDateTime(Value, Fmt); // except here
end;
Exception : ''19/02/2022 11:16:31' is not a valid date and time'