-
Notifications
You must be signed in to change notification settings - Fork 53
Script: GoodMorning
SamuelPlentz edited this page Feb 5, 2020
·
1 revision
This script creates a dynamic greeting depending on the current time.
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";
This script in your template:
[[SCRIPT=GoodMorning]]
would resolve to: Good morning
, Good afternoon
, Good evening
or Good night
depending on the current time.