@sineverba/years-interval
TypeScript icon, indicating that this package has built-in type declarations

2.2.0 • Public • Published

Years Interval

CI / CD Status
NPM npm version
Semaphore CI Build Status
Circle CI CircleCI
Coverall Coverage Status
SonarCloud Quality Gate Status

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-2021

Tests

npm run test for simple test

npm run cover for coverage

Package Sidebar

Install

npm i @sineverba/years-interval

Weekly Downloads

0

Version

2.2.0

License

MIT

Unpacked Size

4.54 kB

Total Files

5

Last publish

Collaborators

  • sineverba