title: React-Native/Firestore - Search by date
body: <p>I'm trying to create a search filter where you can filter by specific date. Not sure what the problem is. It's a react-native project where i'm using hooks (useEffect) to read firestore data. That part work wery well. However i want to  apply a searchfilter where you can select both location and date. </p>
  
  <p>The location part works like a charm. Here is some code example: </p>
  
  <pre><code>   useEffect(() =&gt; {
      db.collection("Name of the collection")
        .where("location", "==", props.searchLocation) 
        .where("date", "==", props.searchDate)
        .onSnapshot(snapshot =&gt; {
  </code></pre>
  
  <p>If i delete the date query part then the location part works fine. Also if i change == to >= on the date part then it displays the data from the selected date and forward.</p>
  
  <pre><code> useEffect(() =&gt; {
      db.collection("Name of collection")
        .where("location", "==", props.searchLocation)
        .where("date", "=&lt;", props.searchDate)
        .onSnapshot(snapshot =&gt; { 
  </code></pre>
  
  <p>But the thing is that i want it to only display the data from the selected date. If i console.log the props.SearchDate then the format looks like this: 
  2019-11-09T00:00:00.000Z.</p>
  
  <p>I'm using react-native base DatePicker to be able to choose date and i also got Moment.js to display the date.</p>
  
  <p>Any thoughts on this? Does it have  anything to do with the date format and time format?</p>
  
  <blockquote>
    <p><strong>Update 1</strong></p>
  </blockquote>
  
  <p>The code im using to set the props.Searchdate and a screenshot of console.log() + instanceof Date</p>
  
  <pre><code>Screen.js  
  const [searchDate, setSearchDate] = useState(new Date());
  console.log(searchDate instanceof Date);
  console.log(searchDate);
  
  component.js
    const datePicker = value =&gt; {
      new Date(props.setSearchDate(value));
    };
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/hFoBB.jpg" rel="nofollow noreferrer">expo console screenshot</a></p>
  
  <blockquote>
    <p><strong>Update 2 - My solution</strong></p>
  </blockquote>
  
  <p>I did solve it with creating two conts at the beginning of the useEffect where i set the time of the chosen date.</p>
  
  <p>Then i query the data by two .where() arguments. </p>
  
  <p>This is my solution if anyone else strugeling with the same thing. However i dont know if it is the best practice. </p>
  
  <pre><code>useEffect(() =&gt; {
      const date1 = new Date(props.searchDate.setHours(0, 0, 0, 0));
      const date2 = new Date(props.searchDate.setHours(23, 59, 59, 59));
      console.log(date1);
      console.log(date2);
      db.collection("Name of collection")
        .where("location", "==", props.searchLocation)
        .where("date", "&gt;=", date1)
        .where("date", "&lt;=", date2)
  </code></pre>