I have a script which loads some data into Firestore from a excel sheet. For each entry that is loaded in, I want to add two fields, dateAdded and dateModified.
const service:Service = {
name: data.PROFISSIONAL,
description: data.DESCRICAO,
category: data.CLASSIFICACAO,
cellphones,
phones,
reviews: reviews,
numReviews: reviews.length,
excluded: data.EXCLUIDO === 'SIM',
instagram: data.INSTAGRAM,
location: data.LOCAL,
dateAdded: Timestamp.now(),
dateModified: Timestamp.now(),
tags: getTags(data.CLASSIFICACAO)
};
I have a intermediate step which saves an array of these services to a json object. The data then gets uploaded to firestore:
const jsonToFirestore = async () => {
console.log(`Uploading table`)
try {
console.log('Initializing Firebase');
initializeApp(serviceAccount);
console.log('Firebase Initialized');
await restore('./data/services.json');
console.log('Upload Success');
}
catch (error) {
console.log(error);
}
};
When I look in the Firebase console though, the date fields have not been recognized as Timestamps.
Is there any way for them to be recognized? Like this for example:
I appreciate any help provided.

