I’m passing a JSON object back and forth using jQuery’s .data(). One of the fields in the array is a string representing a date. When I put the string into the .data() function, it’s a string. When I retrieve it, it’s a js Date object (and it tacks on incorrect time zone information). Is there a way to prevent this functionality?
Share
It sounds like you’re using the HTML5-style data attributes with jQuery .data(), which does coerce the values to the best match, see jQuery online docs about .data()
The work around is to use the .attr() method instead.