How to create Google calendar link date in Javascript 2022?

In 2022 the create Google calendar event link looks like this:

https://calendar.google.com/calendar/u/0/r/eventedit?sf=true&output=xml&text=sometext&location=somelocation&details=somedetails&dates=20220418T013000Z/20220416T020000Z

How do you formate such date in Javascript?

const formatDate = (date) => {
 ???
};
const myDate = new Date();
const myFormattedDate = formatDate(myDate);
console.log(myFormattedDate)

expecting output:

20220418T013000Z

Any nice looking and easy solution (rather than getHours(),getMinutes(),etc.)?