{"action":"created","issue":{"url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/167","labels_url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/167/labels{/name}","comments_url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/167/comments","events_url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/167/events","html_url":"https://github.com/strongloop/loopback-sdk-angular/issues/167","id":96190149,"number":167,"title":"Moment.js: UTC dates get corrupted","user":{"login":"csvan","id":1127729,"avatar_url":"https://avatars.githubusercontent.com/u/1127729?v=3","gravatar_id":"","url":"https://api.github.com/users/csvan","html_url":"https://github.com/csvan","followers_url":"https://api.github.com/users/csvan/followers","following_url":"https://api.github.com/users/csvan/following{/other_user}","gists_url":"https://api.github.com/users/csvan/gists{/gist_id}","starred_url":"https://api.github.com/users/csvan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/csvan/subscriptions","organizations_url":"https://api.github.com/users/csvan/orgs","repos_url":"https://api.github.com/users/csvan/repos","events_url":"https://api.github.com/users/csvan/events{/privacy}","received_events_url":"https://api.github.com/users/csvan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/labels/triage","name":"triage","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-20T23:40:31Z","updated_at":"2015-11-25T22:19:40Z","closed_at":null,"body":"I use moment.js in order to get the start and end dates of the current day, in order to search for events that occur on it:\r\n\r\n```\r\nvar date = moment().utc();\r\n\r\nMyAmazingLoopbackService.find(\r\n{\r\n    filter: {\r\n        where: {\r\n            and: [\r\n                   {createdAt: {gte: date.startOf('day').toDate()}},\r\n                   {createdAt: {lte: date.endOf('day').toDate()}}\r\n            ]\r\n        }\r\n    }\r\n},\r\n// .....\r\n```\r\n\r\nIf I console.log either of the start or end dates above, they show the correct values:\r\n\r\n```\r\nconsole.log(date.startOf('day').toDate()); // Mon Jul 20 2015 02:00:00 GMT+0200 (CEST)\r\nconsole.log(date.endOf('day').toDate()); // Tue Jul 21 2015 01:59:59 GMT+0200 (CEST)\r\n```\r\n\r\nHowever, inspecting the data that is actually sent to the server, it turns out the Angular SDK turn the dates into the following:\r\n\r\n```\r\n{\r\n    \"where\": {\r\n         \"and\": [\r\n               {\"createdAt\": {\"gte\": \"2015-07-20T23:59:59.999Z\"}}, \r\n               {\"createdAt\": {\"lte\": \"2015-07-20T23:59:59.999Z\"}}\r\n          ]\r\n     }\r\n}\r\n```\r\n\r\nIOW the date information gets erased and both values are flattened down to the same time. Is this expected behavior?"},"comment":{"url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/comments/159744422","html_url":"https://github.com/strongloop/loopback-sdk-angular/issues/167#issuecomment-159744422","issue_url":"https://api.github.com/repos/strongloop/loopback-sdk-angular/issues/167","id":159744422,"user":{"login":"davidcheung","id":1787590,"avatar_url":"https://avatars.githubusercontent.com/u/1787590?v=3","gravatar_id":"","url":"https://api.github.com/users/davidcheung","html_url":"https://github.com/davidcheung","followers_url":"https://api.github.com/users/davidcheung/followers","following_url":"https://api.github.com/users/davidcheung/following{/other_user}","gists_url":"https://api.github.com/users/davidcheung/gists{/gist_id}","starred_url":"https://api.github.com/users/davidcheung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/davidcheung/subscriptions","organizations_url":"https://api.github.com/users/davidcheung/orgs","repos_url":"https://api.github.com/users/davidcheung/repos","events_url":"https://api.github.com/users/davidcheung/events{/privacy}","received_events_url":"https://api.github.com/users/davidcheung/received_events","type":"User","site_admin":false},"created_at":"2015-11-25T22:19:40Z","updated_at":"2015-11-25T22:19:40Z","body":"hi @csvan, sounds like a bug, would you know if this issue happens only with `utc()` or any `dates`? or it is an issue with angularSDK parsing `where filter` on just datatype `Date`?, would you be able to create a sample repo to [reproduce the issue](https://github.com/strongloop/loopback/wiki/Reporting-issues#bug-report)?\r\nThanks"}}