Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

135
Visualizações
Firestore query by date

I am tring to query to a Firestore database to a collection and filter by date. I have a Timestamp field (dateStart) and i need to get the results have date today , i don't care about time ,i tried to use this but it works only have same time

My document : 20 septembre 2021 at 01:30:00 UTC+1

refWallet
  .where("dateStart", "==", new Date("2021,09,20"))
  .get()
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You will need a range query with start and end points to cover the intended time. In Firestore, timestamp types are always considered a single point in time and do not have date and time components available. It's the same for Date objects in JavaScript.

refWallet
  .where("dateStart", ">=", startDate)
  .where("dateStart", "<", endDate)
  .get()

If this is not what you want, then you probably shouldn't use a timestamp type field and instead use a string that will give you an exact match. For example, you could store dates as strings formatted YYYYMMDD in order to query for exact dates without ranges.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda