An Interest In:
Web News this Week
- April 2, 2024
- April 1, 2024
- March 31, 2024
- March 30, 2024
- March 29, 2024
- March 28, 2024
- March 27, 2024
January 1, 2022 02:27 pm GMT
Original Link: https://dev.to/nickfrosty/javascript-current-year-with-getfullyear-h1c
JavaScript current year with getFullYear()
Did you hard code the year in your footer? New year, new problems.
With this one-liner, you can dynamically set the year with JavaScript:
let year = new Date().getFullYear();
If you are using VueJS or NuxtJS, you can add the current year code directly into your template section
<template> <footer> Copyright {{ new Date().getFullYear() }} </footer></template>
You can find more useful dev articles on my site, frostbutter.com/articles
Original Link: https://dev.to/nickfrosty/javascript-current-year-with-getfullyear-h1c
Share this article:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To