Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

95
Views
firestore filter range date

Why when I do this filter it returns all records from my database? What I need is that it returns only records within the range of the two dates.

async function toFind() {
console.log("start", dateRangePicker.start);
console.log("end", dateRangePicker.end);
const importacao = db.collection("importacao");
 await importacao
  .orderBy('data')
  .where("data", '>=', dateRangePicker.start)
  .where("data", '<=', dateRangePicker.end)
  .get()
  .then((snapshot) => {
    if (snapshot.empty) {
      toast.error('No matching documents.');
      return;
    }

{ //database comentario: "teste", custo:"3,000", data:"18/08/2021", dolar:"5.56" }

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You seem to be storing your dates as string values with the format "dd/MM/yyyy". That is not a great format for storing dates, as strings are ordered lexicographically and in that order "18/08/2021" is before "19/09/2020".

If you want to store dates, do so in an ISO-8601 format like "2021-08-18". In that format the lexicographical order is the same as the chronological order, so you get the result you want.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!