Status/Resolution/Reason: Closed/Withdrawn/HaveNewInfo
Reporter/Name(from Bugbase): Jörg Zimmer / Jörg Zimmer ()
Created: 10/16/2017
Components: Language, Functions
Versions: 2016,11.0,2018
Failure Type: Incorrectly functioning
Found In Build/Fixed In Build: 11,0,13,292866 /
Priority/Frequency: Normal / Some users will encounter
Locale/System: German / Windows 10 64 bit
Vote Count: 0
_emphasized text_Problem Description:
 Creating a array of structures from a query and then serializing it to json or cfdumping it seems to change the type of strings back to date-fields.
 I loop over a query and set datetime fields to an ISO-Timestring for angularJS.
 But as of Update 12 (and also 13), the reformatted field does not read 2016-10-01T08:00:00Z after sending it through serialiceJSON or cfdump. Instead it's "2016-10-01 10:00:00.0" with .toString() or with serializeJSON it's "October, 01 2016 10:00:00"
Steps to Reproduce:
 Two Functions in an Object called "g":
 function QueryToArrayOfStructures(theQuery){
 var theArray = arraynew(1);
 var cols = ListtoArray(lcase(theQuery.columnlist));
 var row = 1;
 var thisRow = "";
 var col = 1;
 for(row = 1; row LTE theQuery.recordcount; row = row + 1){
 thisRow = structnew();
 for(col = 1; col LTE arraylen(cols); col = col + 1){
 if (lsIsDate(theQuery[cols[col]][row]))
{ theQuery[cols[col]][row] = getIsoTimeString(theQuery[cols[col]][row],true); }
thisRow[cols[col]] = theQuery[cols[col]][row];
 }
 arrayAppend(theArray,duplicate(thisRow));
 }
 return(theArray);
 }
string function getIsoTimeString(required date datetime, boolean convertToUTC=false) {
 if (convertToUTC)
{ datetime = dateConvert("local2utc", datetime); }
return(
 dateFormat(datetime, "yyyy-mm-dd") &
 "T" &
 timeFormat(datetime, "HH:mm:ss") & "Z"
 );
 }
Then a testscript.cfm:
 <cfset g = createObject("component","g")>
 <cfquery name="get" datasource="DSN1">
 select key_task, plan_starttime
 from table1
 limit 1
 </cfquery>
 <cfoutput>
 #get.plan_starttime#<br/>
 #isDate(get.plan_starttime)#<br/>
 #lsisDate(get.plan_starttime)#<br/>
 #g.getIsoTimeString(get.plan_starttime,true)#<br/>
 #g.QueryToArrayOfStructures(get).tostring()#<br/>
 #serializeJSON(g.QueryToArrayOfStructures(get))#<br/>
 <cfdump var="#g.QueryToArrayOfStructures(get)#">
 </cfoutput>
Actual Result:
 2016-10-01 10:00:00.0
 YES
 YES
 2016-10-01T08:00:00Z
 [\{key_task={1234}, plan_starttime=\{2016-10-01 10:00:00.0}}]
 [\{key_task={1234}, plan_starttime=\{October, 01 2016 10:00:00}}]
Expected Result:
 2016-10-01 10:00:00.0
 YES
 YES
 2016-10-01T08:00:00Z
 [{key_task=
{1234},plan_starttime=\{2016-10-01T08:00:00Z}}]
 [\{key_task={1234}
,plan_starttime=\{2016-10-01T08:00:00Z}}]
Any Workarounds:
 Uninstall Update 13 and 12
  Attachments:
Comments: