so I had the date string Friday, April 15, 2022
and I converted it to Thu Apr 14 2022 00:00:00 GMT+0100 (Irish Standard Time)
by string manipulation and now I'm writing it to firebase but it is saving as a string?
I am writing it to firebase like this:
const event = {
Time: eventTime,
start: newEventString,
title: eventName,
allDay: true
}
allEvents.push(event)
const db = fire.firestore();
db.collection("userEventsCal/"+currentUserUID+"/activities").add({event})
Because I am using reactFullCalendar, and the events isn't showing up in the calendar because of the date I think.
I am calling the user event info like below but when I use toDate() on the event start date it can't use it on a string because I know firebase returns a timestamp so I am not sure how to go about fixing this because none of the events are showing up in the react full calendar.
const getUserInfo2 = async () => {
let currentUserUID = fire.auth().currentUser.uid
console.log(currentUserUID)
const qSnap = await fire
.firestore()
.collection('userEventsCal')
.doc(currentUserUID)
.collection("activities")
.get()
const data = []
data = (qSnap.docs.map(d => ({
id: d.id,
title: d.data().event.title,
start: d.data().event.start.toDate(),
allDay: d.data().event.allDay,...d.data() })));
setData([...data])
}