Skip to content

Instantly share code, notes, and snippets.

@grace-snow
Created October 8, 2020 11:57
Show Gist options
  • Save grace-snow/99e81aa630226ac23135a585d4ac5bf6 to your computer and use it in GitHub Desktop.
Save grace-snow/99e81aa630226ac23135a585d4ac5bf6 to your computer and use it in GitHub Desktop.
A little function to insert the current year into something like a copyright notice
// Insert year into footer
function outputCurrentYear() {
const today = new Date();
const currentYear = today.getFullYear();
const el = document.querySelector('#copyright-year');
el.innerHTML = currentYear;
}
outputCurrentYear();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment