Can not properly convert firestore timestamp to unix for algolia index using cloud functions

Hi, Iam using cloud functions to update index in algolia from Firestore, i have two date fields from firestore whose type are timestamp. I am using moment.js to convert both them to unix.
date1 = 19 Mai 1965 at 00:00:00 UTC-4
date2 = 19 Mai 1965 at 00:00:00 UTC-4
census.registration_date = moment(date).unix();
when the index is updated one field gives me the same date all the time regardless of the value in firestore: date1: 1556582400 and the other field date2:{ _seconds: -145759642, nanoseconds:0
I welcome any suggestions to convert firestore timestamp to unix for the algolia index besides moment.js to solve the difference in the format between the two and the fact that date1 is constantly the value. please help thank you in advance.

Hi, did you solve it? I have the same problem.

Just noticed your reply, sry. just in case you didn’t find a solution. I did solve it by using moment.js
date_of_birth = moment(dob).unix
where ‘dob’ is the firestore timestamp