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

185
Visualizações
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 à 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