diff options
author | michael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2012-06-17 08:26:34 +0000 |
---|---|---|
committer | michael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2012-06-17 08:26:34 +0000 |
commit | 65e4438bce9083a043e349a35c224f14cf705f12 (patch) | |
tree | 050aa542c0b36214e39b30fd81f1bd0f0e49f237 /packages/fcl-json | |
parent | 9562a827d06754dcad5d45b9a7bd7202a2ed37d0 (diff) | |
download | fpc-65e4438bce9083a043e349a35c224f14cf705f12.tar.gz |
* Added jsoCheckEmptyDateTime option to check for 0 date/time
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@21628 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/fcl-json')
-rw-r--r-- | packages/fcl-json/src/fpjsonrtti.pp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/packages/fcl-json/src/fpjsonrtti.pp b/packages/fcl-json/src/fpjsonrtti.pp index 15f0c46b8c..239183b16d 100644 --- a/packages/fcl-json/src/fpjsonrtti.pp +++ b/packages/fcl-json/src/fpjsonrtti.pp @@ -20,8 +20,9 @@ Type jsoComponentsInline, // Always stream components inline. Default is to stream name, unless csSubcomponent in ComponentStyle jsoTStringsAsArray, // Stream TStrings as an array of strings. Associated objects are not streamed. jsoTStringsAsObject, // Stream TStrings as an object : string = { object } - jsoDateTimeAsString, - jsoUseFormatString); // Use FormatString when creating JSON strings. + jsoDateTimeAsString, // Format a TDateTime value as a string + jsoUseFormatString, // Use FormatString when creating JSON strings. + jsoCheckEmptyDateTime); // If TDateTime value is empty and jsoDateTimeAsString is used, 0 date returns empty string TJSONStreamOptions = Set of TJSONStreamOption; TJSONFiler = Class(TComponent) @@ -999,7 +1000,9 @@ Var S: String; begin - if (DateTimeFormat<>'') then + if (jsoCheckEmptyDateTime in Options) and (DateTime=0) then + S:='' + else if (DateTimeFormat<>'') then S:=FormatDateTime(DateTimeFormat,DateTime) else if Frac(DateTime)=0 then S:=DateToStr(DateTime) |