{"action":"created","issue":{"url":"https://api.github.com/repos/angular/angular.js/issues/11974","labels_url":"https://api.github.com/repos/angular/angular.js/issues/11974/labels{/name}","comments_url":"https://api.github.com/repos/angular/angular.js/issues/11974/comments","events_url":"https://api.github.com/repos/angular/angular.js/issues/11974/events","html_url":"https://github.com/angular/angular.js/issues/11974","id":82277594,"number":11974,"title":"Date property cannot be merged through \"angular.merge\"","user":{"login":"shaunxu","id":554989,"avatar_url":"https://avatars.githubusercontent.com/u/554989?v=3","gravatar_id":"","url":"https://api.github.com/users/shaunxu","html_url":"https://github.com/shaunxu","followers_url":"https://api.github.com/users/shaunxu/followers","following_url":"https://api.github.com/users/shaunxu/following{/other_user}","gists_url":"https://api.github.com/users/shaunxu/gists{/gist_id}","starred_url":"https://api.github.com/users/shaunxu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shaunxu/subscriptions","organizations_url":"https://api.github.com/users/shaunxu/orgs","repos_url":"https://api.github.com/users/shaunxu/repos","events_url":"https://api.github.com/users/shaunxu/events{/privacy}","received_events_url":"https://api.github.com/users/shaunxu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-05-29T05:49:42Z","updated_at":"2015-05-29T06:36:04Z","closed_at":null,"body":"Assuming I have the code.\r\n```javascript\r\n$scope.obj1 = {\r\n  name: 'Shaun',\r\n  birthDate: new Date(1979, 5, 27)\r\n};\r\n$scope.obj2 = {\r\n  name: 'Shaun Xu'\r\n};\r\n$scope.result = angular.merge({}, obj1, obj2);\r\n```\r\n\r\nI think `$scope.result` should be\r\n```javascript\r\n{\r\n  name: 'Shaun Xu',\r\n  birthDate: new Date(1979, 5, 27)\r\n}\r\n```\r\nBut I got actually\r\n```javascript\r\n{\r\n  name: 'Shaun Xu',\r\n  birthDate: {}\r\n}\r\n```\r\n\r\nI reviewed the source code and found this is because, when performed `baseExtend` it will create an empty object property to destination when source property is object, this is case `birthDate` is Date and also Object. But later when perform `baseExtend` inside `birthDate` there will be nothing to copy since Date object doesn't have any enumerable member.\r\n\r\nI think you should modify `baseExtend`, if the source property is Date, just copy the value to destination rather than performing deep copy.\r\n```javascript\r\nfunction baseExtend(dst, objs, deep) {\r\n  ... ...\r\n  if (deep && isObject(src) && !angular.isDate(src)) {\r\n    if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};\r\n    baseExtend(dst[key], [src], true);\r\n  } else {\r\n    dst[key] = src;\r\n  }\r\n}\r\n```"},"comment":{"url":"https://api.github.com/repos/angular/angular.js/issues/comments/106709145","html_url":"https://github.com/angular/angular.js/issues/11974#issuecomment-106709145","issue_url":"https://api.github.com/repos/angular/angular.js/issues/11974","id":106709145,"user":{"login":"gkalpak","id":8604205,"avatar_url":"https://avatars.githubusercontent.com/u/8604205?v=3","gravatar_id":"","url":"https://api.github.com/users/gkalpak","html_url":"https://github.com/gkalpak","followers_url":"https://api.github.com/users/gkalpak/followers","following_url":"https://api.github.com/users/gkalpak/following{/other_user}","gists_url":"https://api.github.com/users/gkalpak/gists{/gist_id}","starred_url":"https://api.github.com/users/gkalpak/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gkalpak/subscriptions","organizations_url":"https://api.github.com/users/gkalpak/orgs","repos_url":"https://api.github.com/users/gkalpak/repos","events_url":"https://api.github.com/users/gkalpak/events{/privacy}","received_events_url":"https://api.github.com/users/gkalpak/received_events","type":"User","site_admin":false},"created_at":"2015-05-29T06:36:04Z","updated_at":"2015-05-29T06:36:04Z","body":"#11720 will address this issue."}}