Bug Tracker

Modify

Ticket #4770 (closed bug: fixed)

Opened 4 years ago

Last modified 3 years ago

JQuery extend does not copy date objects

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

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

Change History

comment:1 Changed 4 years ago by dmethvin

  • Component changed from unfilled to core

comment:2 Changed 4 years ago by dmethvin

See also #4192.

comment:3 Changed 3 years ago by addyosmani

  • Status changed from new to closed
  • Resolution set to fixed

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.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.