Get the 2024 Yearly Goals and Progress Tracker Notion Template for FREE!

How to Auto Update Copyright Year on Your Website

Posted on: Dec 15, 2023

2 mins read


Copyright is a legal concept that grants the creator exclusive rights to their original work. Updating the copyright year reflects the latest claim, ensuring accurate protection and signaling the content's ongoing relevance and maintenance.

How to Auto Update Copyright Year on Your Website

Code

html
<body>
<p>
All Rights Reserved,
<span id="currentYear"></span>
<a href="https://timonwa.com">Timonwa Akintokun</a>.
</p>
<script>
let date = new Date().getFullYear();
document.getElementById("currentYear").textContent = date;
</script>
</body>

For HTML projects, you can use the above code snippet to update the year automatically on your website.

jsx
const Footer = () => {
let date = new Date().getFullYear();
return (
<p>
All Rights Reserved, {date}.{" "}
<a href="https://timonwa.com">Timonwa Akintokun</a>.
</p>
);
};

You can use the above code snippet for React projects to automatically update the year on your website.

Explanation

The JavaScript Date() object captures the current date and time. Afterward, the getFullYear() method extracts the current year from the obtained date and time. The identified year is stored in a variable named date.

Updating the copyright year is more than just a legal formality; it is a crucial indicator of your commitment to maintaining and protecting your content. Here's why keeping the copyright year current is essential:

  1. Accurate Protection: A current copyright year ensures that you accurately claim protection for your original work, providing a clear timeframe for your exclusive rights.

  2. Relevance Signaling: A recent copyright year signals to your audience that your content is up-to-date and relevant. It shows that you actively manage and maintain your website.

  3. Legal Compliance: Regularly updating the copyright year demonstrates your commitment to legal compliance, reinforcing your dedication to respecting intellectual property laws.

By incorporating the provided JavaScript snippet into your website's footer, you automate the process, ensuring that your copyright year is always current without manual intervention.

Connect With Me

Follow me on X(Twitter), and LinkedIn to stay updated with my latest content.

If you like my notes and want to support me, you can sponsor me on GitHub Sponsor, or you can buy me a virtual ice cream on ByMeACoffee or Selar. I would really appreciate it. 🙏

For other ways to support me, visit my Sponsorship page or Affiliate Links page.

Subscribe to my newsletter 💌

Stay in the loop on the latest articles, tutorials, projects, and exclusive content focused on web development! 💻📚✨