tracker issue : CF-3558382

select a category, or use search below
(searches all categories and all time range)
Title:

SerializeJson improper conversion of dates.

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/CannotReproduce

Reporter/Name(from Bugbase): Donald Langhorne / Donald Langhorne (Donald Langhorne)

Created: 05/10/2013

Components: AJAX, Plumbing

Versions: 10.0

Failure Type: Data Corruption

Found In Build/Fixed In Build: Final /

Priority/Frequency: Critical / All users will encounter

Locale/System: English / Linux All

Vote Count: 0

Problem Description:
SerializeJson() function apparently converts date strings into a specific format.  I am finding that this behavior is not consistent, some things get converted, others do not.

Steps to Reproduce:
Create a CF variable, preferably inside of a structure, set it to a date such as : '2013-05-01 00:00:00' and then use serializeJson to convert it.


Actual Result:
The result I get is SOMETIMES '2013-05-01 00:00:00' and other times: 'May 01, 2013 00:00:00'

Expected Result:
Personally I think this function should either NOT convert dates or provide an option for it.

Any Workarounds:
Use a 3rd party function

----------------------------- Additional Watson Details -----------------------------

Watson Bug ID:	3558382

Deployment Phase:	Release Candidate

External Customer Info:
External Company:  
External Customer Name: dlangh
External Customer Email:  
External Test Config: My Hardware and Environment details:

Attachments:

Comments:

Honestly I was HORRIFIED when I saw that this function was converting dates. Stop and think about it. Coldfusion is CHANGING MY DATA. HOW DARE YOU DO THAT. That is so wrong on SO many levels. It's my problem what format my dates are in, and if I WANT them in a particular format, it's not up to Adobe to decide for me that they know better. Yes I understand that it was so that it would be more compatible with Javascript date object, but that is not a justifiable reason, at least not to make it do this without having an option to not to it. I am am speechless at this. You CHANGED my data!!!!!!!!!! this is in my opinion a MAJOR BUG, not an "feature" as I'm sure you will call it. Finally, I seriously doubt this will result in a change, but I really do hope one of the adobe engineers sees this because it's WRONG!!!!!!!!!!!!!!!!!!!!!!!! Sorry for all the capital letters, but this has ruined my day and my only solution is to find write my own json serializer or find 3rd party. I simply cannot stress enough, please someone STOP and think about this. You CHANGED data!!! I need my dates in the format '2013-05-01 00:00:00' which they are right up until I used serializeJson()
Comment by External U.
15442 | May 10, 2013 01:54:18 PM GMT
We were unable to reproduce this issue consistently. Could you please give us more info on reproducing the issue? The code we wrote is as below, <cfscript> tempStruct = StructNew(); StructInsert(tempStruct, "integerAttribute", "200.01"); StructInsert(tempStruct, "dateAttribute", "2013-05-01 00:00:00"); </cfscript> <cfoutput>#SerializeJSON(tempStruct)#</cfoutput>
Comment by Immanuel N.
15443 | October 11, 2013 12:48:55 AM GMT
I can't replicate this either. Needs a proper repro case. -- Adam
Comment by External U.
15444 | October 11, 2013 04:42:40 AM GMT
I took another look at this yesterday. I'm not sure I can easily provide a way to replicate this. I was able to replicate when I got back a structure from a CFC function. When I did a CFDUMP of the structure which had about 5 dates, they were in the format 'YYYY-MM-DD HH:mm:ss' but when I ran them through serializeJson() they were converted. I then manually created a structure in my test page using all the same variables of that structure and values and serializeJson() did NOT convert the dates, so I don't know what to say. The function that created the structure did nothing special. I will when I have a chance this week create a test CFC that returns a manually created structure to a page that then uses that to pass it through serializeJson. Perhaps it is something about passing a structure that changes it's underlying properties.
Comment by External U.
15445 | November 14, 2013 10:50:42 AM GMT
to clarify with my previous post. I was getting a structure back from a specific CFC, not a simple test CFC. I will try and create a test CFC and see if that can reproduce this.
Comment by External U.
15446 | November 14, 2013 10:51:39 AM GMT
We this issue with different databases, using SQL Server 2008 R2, upgraded to SQL Server 2012, suddenly we get 2013-05-01 00:00:00 instead of May 01, 2013 00:00:00. Checked the session language/locale, nothing different. Will do a full steps to reproduce when I have it and some more testing.
Comment by External U.
15447 | November 25, 2013 04:35:07 PM GMT
Closing the bug since a good repro was not available. Will be reopening the bug if the customer gets back with a repro case.
Comment by Immanuel N.
15448 | December 04, 2014 06:21:19 AM GMT