joaorobertoct2 / x-superobject

Automatically exported from code.google.com/p/x-superobject
0 stars 0 forks source link

TTime and TDateTime problem unsolved :( #48

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Your solution for TTime and TDateTime error does not work for me.
The problem is at line 1929

The problem is when convert from a non english TTime or TDateTime format (es. 
Italian, or other)
from a variant value.

I solved like this:

LFS:=TFormatSettings.Create;
LFS.ShortTimeFormat:='hh:mm:ss.zzz';
LFS.LongTimeFormat:='hh:mm:ss.zzz';
LFS.DecimalSeparator:='.';  // <--- FOR ME THE PROBLEM IS IN "DECIMAL 
SEPARATOR" USED FOR A CAST/CONVERSION FROM STRING TO DATETIME
if (RType = TypeInfo(TTime)) then
  SetValue<Typ>(Data, MemberValue, Member, TValue.From<TTime>(StrToTimeDef(VarToStr(IJSONData.Ancestor[Member].AsVariant), 0, LFS)))
else
  SetValue<Typ>(Data, MemberValue, Member, TValue.From<TDateTime>(StrToDateTimeDef(VarToStr(IJSONData.Ancestor[Member].AsVariant), 0, LFS)))

My best regards.

Original issue reported on code.google.com by isigest...@gmail.com on 7 Oct 2014 at 1:56

GoogleCodeExporter commented 9 years ago
Please send me a sample project. 'hh:mm:ss.zzz' this format is already global. 
If you have a special format? You can use this "TJSONDateManager.Formats"

Original comment by onryld...@gmail.com on 7 Oct 2014 at 5:55

GoogleCodeExporter commented 9 years ago
This is a demo.
I compile it with Delphi XE6

Original comment by isigest...@gmail.com on 8 Oct 2014 at 12:51

Attachments:

GoogleCodeExporter commented 9 years ago
I tryed This project "JSONTest" and I haven't got error message.

Are you sure your SuperObject files actual?

Original comment by b.atalay...@gmail.com on 8 Oct 2014 at 1:53

Attachments:

GoogleCodeExporter commented 9 years ago
I've the last version sync with SVN...
and I got this error

Original comment by isigest...@gmail.com on 8 Oct 2014 at 3:16

Attachments:

GoogleCodeExporter commented 9 years ago
I found the problem...
The problem is with Time Format
whan in long date time format the time separator is "." (dot) the conversion 
fail.

Original comment by isigest...@gmail.com on 11 Dec 2014 at 12:08

GoogleCodeExporter commented 9 years ago
To solve this problem will be change this lines:

In XSuperJSON.pas

line 189:
from <- constructor Create(const Value: TDateTime; const Format: String = 
'yyyy-mm-dd"T"hh:mm:ss.zzz');
to   -> constructor Create(const Value: TDateTime; const Format: String = 
'yyyy-mm-dd"T"hh":"mm":"ss.zzz');

line 203:
from <- constructor Create(const Value: TTime; const Format: String = 
'hh:mm:ss.zzz');
to   -> constructor Create(const Value: TTime; const Format: String = 
'hh":"mm":"ss.zzz');

to bypass the FormatDateTime BUG :(

Original comment by isigest...@gmail.com on 11 Dec 2014 at 2:07

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r89.

Original comment by onryld...@gmail.com on 10 Mar 2015 at 10:20