shaunchander.me
02/17/23 · 1 min · Frontend

Tip #13: Use Date to add the current year to your copyright claim

Typically at the bottom of websites you’ll see something along the lines of ”© Website Name 2023. All Rights Reserved”.

While you can hard-code this piece of content in your footer, I recommend you actually inject the year using a small amount of JavaScript.

That way, when New Years comes around, you can spend your time partying instead of updating your website’s footer to reflect the validity of your copyright 😉.

In HTML, you can very quickly do this by using the following snippet:

<footer>
	<p>&copy; Website Name <span data-year></span>. All Rights Reserved.</p>
</footer>

<script>
	document.querySelector('[data-year]').textContent = new Date().getFullYear();
</script>

If you’re using a frontend library like React, it’s even simpler!

<footer>
	<p>&copy; Website Name {new Date().getFullYear()}. All Rights Reserved.</p>
</footer>
© 2026 · brooklyn, ny 7:34 PM