title: Swift Firebase Query
body: <p>I am using a Firebase query to return orders within a date range. The date is saved as a string. However, this is returning incorrect information.</p>
  <pre><code>    let startDate = &quot;\(selectedDateStart.startOfMonth())&quot;
      let endDate = &quot;\(selectedDateEnd.endOfMonth())&quot;
      let query = DATABASE.mainOrder.child(orderLocation).queryOrdered(byChild: &quot;orderDate&quot;).queryStarting(atValue: startDate).queryEnding(atValue: endDate+&quot;\u{f8ff}&quot;)
      query.observeSingleEvent(of: .value, with:{ (snapshot) in
          if let tallies = snapshot.value as? [String:[String:Any]] {
              self.allFilteredOrdersMonth = self.allFilteredOrdersMonth.merging(tallies) { (_, new) in new }
              for items in tallies.keys {
                  print(&quot;Month Start Date Search: \(startDate), End Date Search: \(endDate), Order #: \(items), Order # Date Created: \(tallies[items]![&quot;orderDate&quot;]!)&quot;)
              }
          }
          completionHandler()
      })
  </code></pre>
  <p>I have attached one of the results below from a query.</p>
  <p>startDate = 01/01/2022</p>
  <p>endDate = 01/31/2022</p>
  <p>Returned Order #: *****</p>
  <p>Returned Order # Date Created: 01/19/2021</p>