title: Firestore Timestamp gets converted to map when processed through cloud function
body: <p>I am having an issue with the firebase.firestore.Timestamp class.</p>
  
  <p>I am working on an Angular 6 app with firestore. I have been using Timestamps with no issues for a while, but I am in the process of moving some of my client-side services to cloud functions. </p>
  
  <p>The issue is this:</p>
  
  <p>When I perform a write operation directly from the client side, such as this:</p>
  
  <pre><code>const doc = { startTimestamp: firebase.firestore.Timestamp.fromDate(new Date()) };
  firebase.firestore().doc('some_collection/uid).set(doc);
  </code></pre>
  
  <p>The document gets written correctly to firestore as a Timestamp.</p>
  
  <p>However, when I send doc to a cloud function, then perform the write from the function, it gets written as a map, not a timestamp. Similarly, if I use a JS Date() object instead of a firestore.Timestamp, it gets written correctly from the client side but written as a string from the cloud function. </p>
  
  <p>This makes sense given that the documents is just JSON in the request.body, I guess I was just hoping that firestore would be smart enough to implicitly handle the conversion. </p>
  
  <p>For now, I have a workaround that just manually converts the objects into firestore.Timestamps again in the cloud function, but I am hoping that there is a more effective solution, possibly something buried in the SDK that I have not been able to find. </p>
  
  <p>Has anyone else come across and, ideally, found a solution for this?</p>
  
  <p>I can provide more code samples if needed.</p>