Things I've Tagged ‘Mood’

Page 1 of 1

#JavaScript, #Mood

Current Mood

This is an old one, but it sure described my day about 5 years ago.

And of course, the code I wasted some time writing to get this ridiculous result.

function howIFeelToday() {
    var d = new Date(),
      h  = d.getHours(),
      hh = (h > 12 ? h - 12 : h),
      m = (d.getMinutes()10?'0':'') + d.getMinutes(),
      a = h  12 ? ' AM' : ' PM',
      time = hh + ':' + m + a,
      feeling = "";

    switch(h) {
        case 8:
        case 9:
        case 10:
        case 11:
            feeling = "Damn, it's only " + time + "!";
            break;
        case 12:
            feeling = time + ", yeah, lunch time!";
            break;
        case 13:
        case 14:
        case 15:
        case 16:
            feeling = time + "...this is the longest day of my entire ever-loving life...";
            break;
        case 17:
            feeling = time + "! Finally. :)";
            break;
        default:
            feeling = "Probably not at work.";
    }   
    return feeling;
}

var currentmood = howIFeelToday();