I checked your code. The issue with your code is you're not dividing the Unix timestamp by 1000. In your code, replace the below line,
function getTimeText(){
const dateInMilliseconds = new Date().getTime() / 1000;
const convertedDate = fromUnixTime(date);
return format(convertedDate, "'Yesterday at' h:m a");
}
Now it should work. If still facing the issue, let me know. I'm happy to help you.