@sineverba/years-interval
v2.2.0
Published
Get an interval of years, useful for copyright notes
Downloads
9
Maintainers
Readme
Years Interval
| CI / CD | Status |
| ------- | ------ |
| NPM |
| Semaphore CI |
|
| Circle CI |
|
| Coverall |
|
| SonarCloud |
|
years interval returns current year or a string made by a year start + current year.
Useful to use in copyright section ("Copyright 2018-2020 by Acme INC").
"2018-2020" in previous example is what you get.
Installation
npm install @sineverba/years-interval
Usage
(In following examples current year is assumed as 2020)
import { GetYearInterval } from '@sineverba/years-interval';
const yearInterval = GetYearInterval("2020");
console.log(yearInterval); // returns 2020
const newYearInterval = GetYearInterval("2018");
console.log(newYearInterval); // returns 2018-2020
// on next year...
console.log(yearInterval); // returns 2020-2021
console.log(newYearInterval); // returns 2018-2021Tests
npm run test for simple test
npm run cover for coverage
