From dc5f605edfd803001eda8761236d03e513dfe513 Mon Sep 17 00:00:00 2001 From: IsaquePinheiro Date: Thu, 27 Jun 2024 13:54:24 -0300 Subject: [PATCH] Fix - Bug --- Examples/delphi/model.person.pas | 5 +++-- Source/Core/jsonbr.utils.pas | 6 +++--- Source/jsonbr.pas | 2 +- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Examples/delphi/model.person.pas b/Examples/delphi/model.person.pas index ab0679c..5d8d92a 100644 --- a/Examples/delphi/model.person.pas +++ b/Examples/delphi/model.person.pas @@ -7,6 +7,7 @@ interface DB, Generics.Collections, /// orm + ormbr.types.nullable, dbcbr.types.mapping, dbcbr.mapping.attributes, dbcbr.mapping.register; @@ -42,7 +43,7 @@ TPerson = class FLastName: String; FAge: Integer; FSalary: Double; - FDate: TDateTime; + FDate: Nullable; FPessoa: TPersonSub; FPessoas: TObjectList; FBlob: String; @@ -78,7 +79,7 @@ TPerson = class [Restrictions([NotNull])] [Column('Date', ftDateTime)] [Dictionary('Nivel','Data de aniversário','Date','','',taRightJustify)] - property Date: TDateTime read FDate write FDate; + property Date: Nullable read FDate write FDate; [Column('Imagem', ftBlob)] property Imagem: String read FBlob write FBlob; diff --git a/Source/Core/jsonbr.utils.pas b/Source/Core/jsonbr.utils.pas index ca130e7..b3cbf17 100644 --- a/Source/Core/jsonbr.utils.pas +++ b/Source/Core/jsonbr.utils.pas @@ -25,7 +25,7 @@ function DateTimeToIso8601(const AValue: TDateTime; begin Result := ''; if AValue = 0 then - exit; + Exit; if AUseISO8601DateFormat then LDatePart := FormatDateTime('yyyy-mm-dd', AValue) @@ -33,7 +33,7 @@ function DateTimeToIso8601(const AValue: TDateTime; LDatePart := DateToStr(AValue, GJsonBrFormatSettings); if Frac(AValue) = 0 then - Result := ifThen(AUseISO8601DateFormat, LDatePart, TimeToStr(AValue, GJsonBrFormatSettings)) + Result := ifThen(AUseISO8601DateFormat, LDatePart, DateToStr(AValue, GJsonBrFormatSettings)) else begin LTimePart := FormatDateTime('hh:nn:ss', AValue); @@ -55,7 +55,7 @@ function Iso8601ToDateTime(const AValue: String; if not AUseISO8601DateFormat then begin Result := StrToDateTimeDef(AValue, 0); - exit; + Exit; end; LYYYY := 0; LMM := 0; LDD := 0; LHH := 0; LMI := 0; LSS := 0; LMS := 0; if TryStrToInt(Copy(AValue, 1, 4), LYYYY) and diff --git a/Source/jsonbr.pas b/Source/jsonbr.pas index 7d44691..2f69bcc 100644 --- a/Source/jsonbr.pas +++ b/Source/jsonbr.pas @@ -174,7 +174,7 @@ class function TJsonBr.ObjectListToJsonString(AObjectList: TObjectList; class function TJsonBr.ObjectListToJsonString(AObjectList: TObjectList; AStoreClassName: Boolean): String; var - LFor: integer; + LFor: Integer; LResultBuilder: TStringBuilder; begin LResultBuilder := TStringBuilder.Create;