Skip to main content

Bug Tracker

Side navigation

#4770 closed bug (fixed)

Opened June 15, 2009 07:56PM UTC

Closed October 07, 2010 08:47PM UTC

JQuery extend does not copy date objects

Reported by: bernie.kovacic@veriz Owned by:
Priority: major Milestone: 1.4
Component: core Version: 1.3.2
Keywords: Cc:
Blocked by: Blocking:
Description

JQuery.extend does not copy Date Objects correctly. ex.

var newObj = {

newDate: new Date(),

deepObj: {

newerDate: new Date()

}

};

var copyObj = jQuery.extend(true,{},newObj);

empty objects are returned instead of copies of the dates

Attachments (0)
Change History (3)

Changed August 07, 2009 05:39PM UTC by dmethvin comment:1

component: unfilledcore

Changed October 02, 2009 02:08AM UTC by dmethvin comment:2

See also #4192.

Changed October 07, 2010 08:47PM UTC by addyosmani comment:3

resolution: → fixed
status: newclosed

Reproducing your original code in this Live test http://jsfiddle.net/addyosmani/jGHWn/3/ I can verify that 1.3.2 wasn't correctly returning the values of the deepObj or copyObj objects.

This has been corrected since 1.3.2 and if you run the test with 1.4.2 enabled in jsFiddle you will see that the correct date (object accessed) values are being output now.