Script: GoodMorning - jobisoft/quicktext GitHub Wiki

This script creates a dynamic greeting depending on the current time.

Script

var date = new Date();
if (date.getHours() <  5) return "Good night";
if (date.getHours() < 12) return "Good morning";
if (date.getHours() < 16) return "Good afternoon";
if (date.getHours() < 21) return "Good evening";

return "Good night";

Usage

This script in your template:

[SCRIPT=GoodMorning](/jobisoft/quicktext/wiki/SCRIPT=GoodMorning)

would resolve to: Good morning, Good afternoon, Good evening or Good night depending on the current time.