I'm trying to store a document in my Firebase Cloud Firestore which has two Timestamp fields: purchaseDate and expirationDate.
purchaseDate is the current date, and expirationDate is 2 weeks from current date.
I am using a post Cloud Functions request to set the doc.
I was able to achieve the current date (purchaseDate) like this:
const purchaseDate = admin.firestore.Timestamp.now();
But I can't figure out how to achieve a Timestamp for 2 weeks from current date.
I've tried to achieve it in several ways, including this exmaple, but nothing worked:
admin.firestore.Timestamp.fromDate(purchaseDate + 12096e5); //12096e5 = 2 weeks in ms
Any idea how can I achieve it?
Thank you very much!