• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Pruebas Online
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

190
Vistas
How to update Firestore Timestamp to a future value

We have a check-in and check-out component in our web app that simply uses firebase timestamps. However, we need the ability to edit those timestamps in the event someone makes a mistake.

checkInTimeStamp: fb.firestore.FieldValue.serverTimestamp("17:00") simply returns the current time.

Instead of 17:00, what object do we need to pass through the function to get the correct timestamp?

almost 3 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The serverTimestamp() generates current timestamp on server side. You can use a Date object instead to store a future date:

const futureDate = new Date();

// update date to future time
futureDate.setDate(futureDate.getDate() + 5);

db.document('col/doc').set({ checkInTimeStamp: futureDate })

Checkout other method like setDate() in MDN docs.

almost 3 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda