Skip to content

Commit

Permalink
Fix - Bug
Browse files Browse the repository at this point in the history
  • Loading branch information
isaquepinheiro committed Jun 27, 2024
1 parent eb3ae9d commit dc5f605
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions Examples/delphi/model.person.pas
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ interface
DB,
Generics.Collections,
/// orm
ormbr.types.nullable,
dbcbr.types.mapping,
dbcbr.mapping.attributes,
dbcbr.mapping.register;
Expand Down Expand Up @@ -42,7 +43,7 @@ TPerson = class
FLastName: String;
FAge: Integer;
FSalary: Double;
FDate: TDateTime;
FDate: Nullable<TDateTime>;
FPessoa: TPersonSub;
FPessoas: TObjectList<TPersonSub>;
FBlob: String;
Expand Down Expand Up @@ -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<TDateTime> read FDate write FDate;

[Column('Imagem', ftBlob)]
property Imagem: String read FBlob write FBlob;
Expand Down
6 changes: 3 additions & 3 deletions Source/Core/jsonbr.utils.pas
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ function DateTimeToIso8601(const AValue: TDateTime;
begin
Result := '';
if AValue = 0 then
exit;
Exit;

if AUseISO8601DateFormat then
LDatePart := FormatDateTime('yyyy-mm-dd', AValue)
else
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);
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Source/jsonbr.pas
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class function TJsonBr.ObjectListToJsonString(AObjectList: TObjectList<TObject>;
class function TJsonBr.ObjectListToJsonString<T>(AObjectList: TObjectList<T>;
AStoreClassName: Boolean): String;
var
LFor: integer;
LFor: Integer;
LResultBuilder: TStringBuilder;
begin
LResultBuilder := TStringBuilder.Create;
Expand Down

0 comments on commit dc5f605

Please sign in to comment.