try {
const docRef = await addDoc(collection(db, "question"), {
title: writingTitle,
createdAt: serverTimestamp(),
});
If you write servertimestamp() when you write, the console window says {seconds=123123123, nanosecond=!@!@}} like this. How can I change this to Date on the web?
To convert a Firestore timestamp to a date, call toDate() on it after reading the value from the database. For more on this, see the reference docs.
There is no way to get the value before that/without reading it, as serverTimestamp() only generates a token value/sentinel that the database server recognizes as a signal to write the date/time.