How would I display something like "Sunday Morning" if it’s before 12pm or "Sunday Afternoon" if it’s after 12pm?
I’m using the below to get the current day
var now = moment().format("dddd");
$("#date").append(now);
<span id="date"></span>
How would I display something like "Sunday Morning" if it’s before 12pm or "Sunday Afternoon" if it’s after 12pm?
I’m using the below to get the current day
var now = moment().format("dddd");
$("#date").append(now);
<span id="date"></span>
Moment.js unfortunately doesn’t have a built-in token for morning/afternoon/evening, but you can fake it.
Something like this will probably do the trick:
Please note that moment.js is being phased out and is not recommended for use in new projects.