Using regex, you can simply reorder the parts of your date string to create a compatible ISO 8601 date string which is accepted by the new Date()
constructor.
const date_string = "20220101"
const oDate = new Date(date_string.replace(/(\d{4})(\d{2})(\d{2})/, '$1-$2-$3'))
console.log(oDate.toUTCString())