Created
December 3, 2021 16:30
-
-
Save kieranbarker/2c300d73059697a4417e12bd40cdef75 to your computer and use it in GitHub Desktop.
Get today's date.
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
/** | |
* Get today's date. | |
* https://gist.github.com/kieranbarker/2c300d73059697a4417e12bd40cdef75 | |
* @returns {Date} A Date object representing today's date at midnight in UTC. | |
*/ | |
function getTodaysDate() { | |
const dateString = new Date().toISOString().slice(0, 10); | |
return new Date(dateString); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Read the blog post.