Opened 11 years ago
Closed 11 years ago
#11481 closed bug (invalid)
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);
}
}
Change History (3)
comment:1 Changed 11 years ago by
Owner: | set to JayAchTee |
---|---|
Status: | new → pending |
comment:2 Changed 11 years ago by
Status: | pending → new |
---|
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!
comment:3 Changed 11 years ago by
Component: | unfiled → misc |
---|---|
Priority: | undecided → low |
Resolution: | → invalid |
Status: | new → closed |
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.