Skip to main content

Bug Tracker

Side navigation

#11481 closed bug (invalid)

Opened March 16, 2012 01:21PM UTC

Closed March 18, 2012 03:46PM UTC

jQuery.param does not serialize Date objects correctly

Reported by: JayAchTee Owned by: JayAchTee
Priority: low Milestone: None
Component: misc Version: 1.7.1
Keywords: Cc:
Blocked by: Blocking:
Description

When using deep serialization, JavaScript Date objects are not serialized correctly. They are skipped in the buildParams method "for (var name in obj)" code because they are typeof "object" but have no "name" property.

This bug was exposed by using Telerik's Kendo UI grid with server-side filtering enabled.

I tested using the following (near line 9048 of the unminified version) and it seems to resolve the issue:

if (obj instanceof Date)

{

add(prefix, obj);

}

else

{

for (var name in obj)

{

buildParams(prefix + "[" + name + "]", obj[name], traditional, add);

}

}

Attachments (0)
Change History (3)

Changed March 16, 2012 01:27PM UTC by sindresorhus comment:1

owner: → JayAchTee
status: newpending

Thanks for taking the time to contribute to the jQuery project! Please provide a complete reduced test case on jsFiddle to help us assess your ticket.

Additionally, be sure to test against the jQuery Edge version to ensure the issue still exists. To get you started, use this boilerplate: http://jsfiddle.net/FrKyN/ Open the link and click to "Fork" (in the top menu) to get started.

Changed March 18, 2012 10:59AM UTC by JayAchTee comment:2

_comment0: It appears that jQuery v1.7.2pre Live from Git has this fixed! Changing to "jQuery.type( obj ) === "object"" works as expected!1332068641213836
status: pendingnew

It appears that jQuery v1.7.2pre Live from Git has this fixed! Changing to "jQuery.type( obj ) === "object"" works as expected!

Thanks for your help on this issue!

Changed March 18, 2012 03:46PM UTC by sindresorhus comment:3

component: unfiledmisc
priority: undecidedlow
resolution: → invalid
status: newclosed