there are JavaScript to check text contain includes function what error

<p class="time">
<span>1m ago</span>
<span>2 days ago</span>
</p>
<script>
let time = document.getElementsByClassName("time02");

if (time.textContent.includes("1m ago")) {
    console.log ("you have a message 1 minute before")
}
else {
    console.log ("before 1 days")
}
</script>

showing that error…

Uncaught TypeError: Cannot read properties of undefined (reading ‘includes’)?