Hi,

this is because jQuery creates anonymous objects for the clones and
copies the object properties. For the Date object there are no public
properties, so only the empty object hull is created.

But you are right, not copying Dates correctly is a bit strange.
If you disable the copy deep flag, your date will be in the clone, but
in this case it's no clone, but a reference to the original date
object.


by(e)
Stephan



2009/2/5 Tin <michael.leib...@gmail.com>:
>
> Hi guys,
> I'm trying to create a deep copy of an object with $.extend(true, {},
> obj), but I've noticed that all of the dates get copied as a simple
> Object with no properties.  Here's a sample code that demonstrates it:
>
> var clone = $.extend(true, {}, {myDate:new Date()});
>
> // clone.myDate returns {}
> // clone.myDate.toString() -> [object Object]
>
> Any ideas on why this is happening?
>
>

Reply via email to