{"action":"created","issue":{"url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/921","repository_url":"https://api.github.com/repos/firebase/firebase-js-sdk","labels_url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/921/labels{/name}","comments_url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/921/comments","events_url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/921/events","html_url":"https://github.com/firebase/firebase-js-sdk/issues/921","id":332117117,"node_id":"MDU6SXNzdWUzMzIxMTcxMTc=","number":921,"title":"Firestore timestamps replaced with object","user":{"login":"baikunz","id":984911,"node_id":"MDQ6VXNlcjk4NDkxMQ==","avatar_url":"https://avatars1.githubusercontent.com/u/984911?v=4","gravatar_id":"","url":"https://api.github.com/users/baikunz","html_url":"https://github.com/baikunz","followers_url":"https://api.github.com/users/baikunz/followers","following_url":"https://api.github.com/users/baikunz/following{/other_user}","gists_url":"https://api.github.com/users/baikunz/gists{/gist_id}","starred_url":"https://api.github.com/users/baikunz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/baikunz/subscriptions","organizations_url":"https://api.github.com/users/baikunz/orgs","repos_url":"https://api.github.com/users/baikunz/repos","events_url":"https://api.github.com/users/baikunz/events{/privacy}","received_events_url":"https://api.github.com/users/baikunz/received_events","type":"User","site_admin":false},"labels":[{"id":710626490,"node_id":"MDU6TGFiZWw3MTA2MjY0OTA=","url":"https://api.github.com/repos/firebase/firebase-js-sdk/labels/Component-Firestore","name":"Component-Firestore","color":"e881d1","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-06-13T18:44:43Z","updated_at":"2018-06-19T17:51:56Z","closed_at":null,"author_association":"NONE","body":"<!-- Step 1 [READ THIS] -->\r\n<!--\r\nAre you in the right place?\r\n  * For issues or feature requests related to __the code in this repository__\r\n    file a Github issue.\r\n    * If this is a __feature request__ make sure the issue title starts with \"FR:\".\r\n  * For general technical questions, post a question on [StackOverflow](http://stackoverflow.com/)\r\n    with the firebase tag.\r\n  * For general Firebase discussion, use the [firebase-talk](https://groups.google.com/forum/#!forum/firebase-talk)\r\n    google group.\r\n  * For help troubleshooting your application that does not fall under one\r\n    of the above categories, reach out to the personalized\r\n    [Firebase support channel](https://firebase.google.com/support/).\r\n-->\r\n\r\n<!-- Step 2 -->\r\n\r\n### [REQUIRED] Describe your environment\r\n\r\n  * Operating System version: N/A\r\n  * Firebase SDK version:  5.0.2\r\n  * Firebase Product: firestore\r\n\r\n<!-- Step 3 -->\r\n\r\n### [REQUIRED] Describe the problem\r\n\r\n#### Steps to reproduce:\r\n<!--\r\n  What happened? How can we make the problem occur?\r\n  This could be a description, log/console output, etc.\r\n-->\r\nThis is a tricky one. The issue is only appearing randomly and not quite often.\r\nI'm using a service responsible to add a `createdAt` field on every document I create/update, using this snippet: \r\n```js\r\ncreatedAt: document.createdAt || serverTimestamp()\r\n```\r\nThis code adds the server timestamp to the `createdAt` field if it's not there, otherwise it just keeps the value that was there. And most of the time it works just fine.\r\nBut I started noticing that sometimes my field was filled with an object in firestore instead of the timestamp.\r\nThe object saved has 2 properties: `nanoseconds` and `seconds` like the one returned from firestore.\r\n\r\nI looked around my code, but I never edit this field anywhere, I expected it to stay a timestamp if it's not edited.\r\nI don't even know if this code snippet is responsible for this behaviour but this is the only hint I could find.\r\n\r\nEDIT: It looks like it's actually related to all input fields with timestamps which get resubmitted with a .set().\r\nEDIT2: I'm using the `timestampsInSnapshots: true` setting on firestore"},"comment":{"url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/comments/398487818","html_url":"https://github.com/firebase/firebase-js-sdk/issues/921#issuecomment-398487818","issue_url":"https://api.github.com/repos/firebase/firebase-js-sdk/issues/921","id":398487818,"node_id":"MDEyOklzc3VlQ29tbWVudDM5ODQ4NzgxOA==","user":{"login":"var-const","id":8216808,"node_id":"MDQ6VXNlcjgyMTY4MDg=","avatar_url":"https://avatars1.githubusercontent.com/u/8216808?v=4","gravatar_id":"","url":"https://api.github.com/users/var-const","html_url":"https://github.com/var-const","followers_url":"https://api.github.com/users/var-const/followers","following_url":"https://api.github.com/users/var-const/following{/other_user}","gists_url":"https://api.github.com/users/var-const/gists{/gist_id}","starred_url":"https://api.github.com/users/var-const/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/var-const/subscriptions","organizations_url":"https://api.github.com/users/var-const/orgs","repos_url":"https://api.github.com/users/var-const/repos","events_url":"https://api.github.com/users/var-const/events{/privacy}","received_events_url":"https://api.github.com/users/var-const/received_events","type":"User","site_admin":false},"created_at":"2018-06-19T17:51:56Z","updated_at":"2018-06-19T17:51:56Z","author_association":"COLLABORATOR","body":"@baikunz Thanks for the repro case! I'll investigate and will post an update here when I have it."}}
{"actor":{"display_login":"var-const"}}