footer-year
v1.0.8
Published
Tiny TypeScript utility to generate dynamic footer year text
Maintainers
Readme
footer-year
A tiny TypeScript utility to generate dynamic footer year text for websites and systems.
Perfect for keeping your footer copyright year up to date automatically.
✨ Features
- Automatically uses the current year
- Supports single year or range (start → current year)
- Optional custom message
- Zero dependencies
- TypeScript-first (with type definitions included)
- Works in Node.js, React, Next.js, Vue, plain JS
Why use footer-year?
Most projects hardcode years in footers and forget to update them. This utility keeps your footer automatically current, with minimal setup.
📦 Installation
npm install footer-year📝 Usage
import { footerYear } from "footer-year";
console.log(footerYear()); // "<currentYear> ©"Single Year
footerYear();
// "<currentYear> ©"Range
footerYear({
format: "range",
startYear: 2020,
});
// "2020 - <currentYear> ©"If startYear is the same as the current year, range mode returns a single year:
footerYear({
format: "range",
startYear: new Date().getFullYear(),
});
// "<currentYear> ©"Custom Message
footerYear({
message: " My Company",
});
// "<currentYear> © My Company"HTML Output
footerYear({
format: "range",
startYear: 2020,
html: true,
});
// "<span>2020 - <currentYear> ©</span>"