* Added jsoCheckEmptyDateTime option to check for 0 date/time

git-svn-id: trunk@21628 -
This commit is contained in:
michael 2012-06-17 08:26:34 +00:00
parent 872409d293
commit 7718db9b5e

View File

@ -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)