This was originally an AppleScript that someone somewhere crafted for me, then TextExpander Support was kind enough to convert to JavaScript for me (I am not a coder).
It checks what time it is, then spits out “Good Morning/Afternoon/Evening” based on the time. I no longer need to check the clock before crafting an email or text.
The best part is that it works everywhere now, instead of just macOS.
var today = new Date();
var time = today.getHours();
if (time < 12) {
output ="Good morning"
} else if (time < 18) {
output ="Good afternoon"
} else {
output ="Good evening"
}