This is a bit old but just figure out how to do this in a Svelte project. I assume this would also work in a React project (sorry don't know much about Vue). The kicker is that I am using Web version 9.
import { Timestamp } from "@firebase/firestore";
let noteDate = Timestamp.fromDate(new Date());
Just for context... I am adding this new note object to the UI. When it was just a javascript date it worked fine with firebase but I could not call the required .toDate() without seeing an UI error.
<TimeAgo date={note.NoteDate.toDate()} />
So making this a firebase.Timestamp was my way of avoiding the UI error when calling .toDate on a javascript date object.