Skip to content

Instantly share code, notes, and snippets.

@kieranbarker
Created December 3, 2021 16:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kieranbarker/2c300d73059697a4417e12bd40cdef75 to your computer and use it in GitHub Desktop.
Save kieranbarker/2c300d73059697a4417e12bd40cdef75 to your computer and use it in GitHub Desktop.
Get today's date.
/**
* 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);
}
@kieranbarker
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment