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