Last active
April 12, 2018 14:39
-
-
Save jngnyc/ebef88a5fae61992dcc165b564aa6f03 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
window.WebhookUtils = { | |
upperCase: function (val) { | |
if (val) { | |
val = val.toUpperCase(); | |
} | |
return val; | |
}, | |
// Lowercase transformation: | |
lowerCase: function (val) { | |
if (val) { | |
val = val.toLowerCase(); | |
} | |
return val; | |
}, | |
// convert timestamp in UNIX time format to human-readable format | |
unixTimeToHumanReadable: function (val) { | |
var date = val; | |
// Hours part from the timestamp | |
var hours = date.getHours(); | |
// Minutes part from the timestamp | |
var minutes = "0" + date.getMinutes(); | |
// Seconds part from the timestamp | |
var seconds = "0" + date.getSeconds(); | |
// Will display time in 10:30:23 format | |
var formattedTime = hours + ':' + minutes.substr(-2) + ':' + seconds.substr(-2); | |
return formattedTime; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment