title: How to save and search for EXACT date?
body: <h2>Setup</h2>
  
  <p>I'm creating a react app to save and retrieve daily reports from MongoDb Atlas database. There can be only one report per day per user. The search criteria for daily reports is the date of course. </p>
  
  <h2>Logic and code</h2>
  
  <p>The app has a calendar widget from material-ui datepicker. It returns the selected date with the current UTC time. But if I search the database using that directly, then obviously I won't find anything because of the difference of hours:minutes:seconds:milliseconds. It's impossible that the Date() that you're searching for would have the exact millisecond match with the time the report was created. So my idea was to store the date for each report with a time of exactly 12am i.e. 00:00:00:000Z as well as search the database with a date of time 12am.</p>
  
  <pre><code>selectedDate.setUTCHours(0,0,0,0); //sets the time to 12am
  selectedDate.toISOString(); 
  </code></pre>
  
  <h2>Question</h2>
  
  <p>Is this the right approach for this case? Will I face problems down the line doing it this way? How should the date be stored if it's the search criteria and if it has to be the exact match? Also it must serve any user around the world to save and retrieve their reports.</p>
  
  <p>Thanks,
  Suraj</p>