Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

186
Vistas
Firebase Firestore stores wrong timestamp on server but correct timestamp in emulator

Am looking for the solution for this issue from long time, failed to figure out what is actually causing this. Am doing a project where some modules depends on various datetime calculations, user enters the date and time in a csv file like this. date and time in csv file

am reading that file and format the date and time using momenttz library, below is the code.

 const getTimestamp = (time_array,date_object) => {
    let year = date_object.substr(0,4);
    let month = (parseInt(date_object.substr(4,2)) -1);
    let date = date_object.substr(6,2);

    let hour = parseInt(time_array[0]);
    let minute = parseInt(time_array[1]);
    let second = parseInt(time_array[2]);
    console.log("hr ",hour, " minutes ", minute, " second ", second);

    let momentTime = moment.utc({ years:year, months:month, date:date, hours:hour, minutes:minute, seconds:second});
    console.log("momentTime",momentTime); // this log shows correct date and time as mentioned in csv (Moment<2021-09-21T13:25:00Z>)
     const firestore = admin.firestore;
    return firestore.Timestamp.fromDate(momentTime.valueOf());
}

then passing this to firebase add/update query. this is working fine in local emulator, showing correct date and time. for example if i pass 13:25:00 it storing same in local firestore emulator.

But on firestore console saves wrong time(18:55:00 UTC +5:30) 5hrs 30min more than what i provided. firestore console

even i changed the system time zone to Clint's time zone(Tokyo zone) to check if it is due to time zone, but still it is 9.5 hours more than client's time.

Note: i know firestore don't care about the time zone and it stores timestamp in epoch format. How can i resolve this issue?

about 4 years ago · Juan Pablo Isaza
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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda