Skip to content

Instantly share code, notes, and snippets.

andela-bm bmuthoga

Block or report user

Report or block bmuthoga

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bmuthoga / momentjs.humanized.triplesplit.time.js
Created Mar 28, 2019 — forked from James1x0/momentjs.humanized.triplesplit.time.js
Get a humanized, "Morning", "Afternoon", "Evening" from moment.js **Great for user greetings!**
View momentjs.humanized.triplesplit.time.js
function getGreetingTime (m) {
var g = null; //return g
if(!m || !m.isValid()) { return; } //if we can't find a valid or filled moment, we return.
var split_afternoon = 12 //24hr time to split the afternoon
var split_evening = 17 //24hr time to split the evening
var currentHour = parseFloat(m.format("HH"));
if(currentHour >= split_afternoon && currentHour <= split_evening) {
You can’t perform that action at this time.