title: How to query Firestore based on a date condition
body: <p>In Firestore, I have a "tasks" collection containing several documents (each is a "task"). Each task has a "dueDate" field.</p>
  
  <p>I would like to query tasks due today onwards.</p>
  
  <p>I know I could get today's date from the device, but that is not safe, as user can change the date from Settings and then be able to query by any date. I do not want user to view tasks due in the past.</p>
  
  <p>What I am looking for is a way to generate today's date on the server, then use it as a filter for the query.</p>
  
  <p>Something like:</p>
  
  <pre><code>let todayMidnight = &lt;get server timestamp, then reset time components to 0 (to start at midnight)&gt;
  
  databaseReference.collection("tasks").order(by: "date").whereField(field: "date", isGreaterThan: todayMidnight).getDocuments()
  </code></pre>
  
  <p>Edit: I know I could use Cloud Functions to do this query but I guess I lose the ability to create listeners on my application that would auto-update data in the app once it changes.</p>