Created
June 28, 2016 20:03
-
-
Save JTBrinkmann/08329adb12ebf9d9ac0c9eae0cb64bbe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
aux = { | |
pad: function(num, digits){ | |
return 0 <= num && num < 10 | |
? "0" + num | |
: num + "" | |
}, | |
getChatTimestamp: function(is24h) { | |
d = new Date() | |
h = d.getHours() | |
if (is24h) { | |
return pad(h) + ":" + pad(d.getMinutes()) | |
} else { | |
return pad(h % 12 || 12) + ":" + pad(d.getMinutes()) + " " + (h < 12 ? 'am' : 'pm') | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment