Status/Resolution/Reason: Closed/Withdrawn/DesignLimitation
Reporter/Name(from Bugbase): Aaron Neff / ()
Created: 04/28/2018
Components: Language, Serialization
Versions: 2018
Failure Type: Data Loss
Found In Build/Fixed In Build: 2018.0.01.308605 (PreRelease) /
Priority/Frequency: Normal / Most users will encounter
Locale/System: / Platforms All
Vote Count: 0
Issue: WDDX (correct) vs JSON (incorrect) wrt DateTime
Repro:
WDDX gets it right (maintains UTC offset and deserializses back to DateTime):
<cfscript>
myDateTime = createDate(2018,1,1)
cfwddx(action="cfml2wddx", input=myDateTime, output="myDateTimeWDDX")
cfwddx(action="wddx2cfml", input=myDateTimeWDDX, output="myDateTimeFromWDDX")
writeOutput(myDateTimeWDDX & ' | ' & myDateTimeFromWDDX.getClass().getName())
</cfscript>
Actual and Expected Result: 2018-01-01T00:00:00-05:00 | coldfusion.runtime.OleDateTime
JSON gets it wrong (loses UTC offset and deserializes back to String):
<cfscript>
myDateTime = createDate(2018,1,1)
myDateTimeJSON = serializeJSON(myDateTime)
myDateTimeFromJSON = deserializeJSON(myDateTimeJSON)
writeOutput(myDateTimeJSON & ' | ' & myDateTimeFromJSON.getClass().getName())
</cfscript>
Actual Result: "January, 01 2018 00:00:00" | java.lang.String
Expected Result: 2018-01-01T00:00:00-05:00 | coldfusion.runtime.OleDateTime
Note: Since Aether's fixing JSON for Numeric, it should also fix JSON for DateTime.
Note: There is data loss when a serializeJSON()'d datetime moves between 2 systems having different OS/JVM time zones. B/c, currently the systems assume the datetime is in _their_ time zone.
Attachments:
Comments: