I am quite new to firestore, so my question might be very obvious.
I try to add data to firestore as follows:
try {
await setDoc(doc(db, "appointments", id), data, {
merge: true,
}).then(handleSuccess());
} catch (e) {
handleError(e);
}
and my data (which comes from scheduler) is as follows:
Object { title: "data", startDate: Date Sat Aug 10 2024 13:30:00 GMT+0200 (Central European Summer Time), endDate: Date Sat Aug 10 2024 14:00:00 GMT+0200 (Central European Summer Time), allDay: false, notes: "data" }
It works perfectly.
However, after reading some more docs, I realized that perhaps I should rather convert date to firebase date format. Then I developed a converting function and now what I add looks like this:
Object { title: "fff", startDate: {…}, endDate: {…}, allDay: false, notes: "fff", exDate: undefined }
allDay: false
endDate: Object { seconds: 1722942000, nanoseconds: 0 }
exDate: undefined
notes: "fff"
startDate: Object { seconds: 1722940200, nanoseconds: 0 }
title: "fff"
And this does not work (does not add items). I suspected that that is because one can not mix types in one collection, but not, even when removed all the records from collection, and try to add—it simply does not.
Let me know whether my understanding is false. Should I use working format and not care about the rest?