Dynamically Display Current Year - Great for Copyright Notices
I almost always use this code snippet (or something like it) when I build a new site. This is great for displaying a dynamic copyright notice where you need to display the current year's value (usually in the footer).
1<div>
2 <div className="opacity-50">
3 © {new Date().getFullYear()} Rich Leach. All Rights Reserved.
4 </div>
5</div>
Summary: This code creates a new date object and displays only the year of the current date.