Created
January 24, 2019 13:02
-
-
Save Kelderic/9803a9bf1ec6acfa374abcfe92d31cb8 to your computer and use it in GitHub Desktop.
Javascript has Date.toLocaleDateString and Date.toLocaleTimeString, but no toISOTimeString. This code adds in the missing functionality.
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
Date.prototype.toISOTimeString = function() { | |
// CREATE ISO STRING AND RETURN JUST THE TIMESTAMP PORTION | |
return this.toISOString().split('T')[1]; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment