Make copyright's great again
JavaScript
Latest commit fd1715c Oct 15, 2016 @dawsonbotsford 1.1.1
Permalink
Failed to load latest commit information.
.github
.editorconfig
.gitattributes init Mar 16, 2016
.gitignore
.travis.yml
appveyor.yml
bundle.js
index.js remove useless template literal Oct 15, 2016
license switch license to be me Mar 27, 2016
package.json 1.1.1 Oct 15, 2016
readme.md
test.js rename to rainge Mar 17, 2016

readme.md

rainge

npm version npm download count XO code style

Linux & OSX Windows

Use date ranges that never need updating


Install

npm install --save rainge


Usage

Node

const rainge = require('rainge');

// assuming the current year is 2016:
rainge(2016);
//=> '2016'

rainge(1999);
//=> '1999 - 2016'


Web

<script src="https://rawgit.com/dawsonbotsford/rainge/master/bundle.js"></script>
<script>
  alert('\u00A9 ' + rainge(1999));
  //=> © 1999 - 2016
</script>


Or download it with npm install --save rainge and reference it as:

<script src="node_modules/rainge/bundle.js"></script>


About

I was tired of seeing websites in 2016 that said

© 2015

or even worse

© 2012 - 2014

Using rainge, you set your copyright year once and it will automatically change year-to-year. rainge(2016) would return "2016" until 2017, at which point rainge(2016) would return "2016 - 2017"


API

rainge(startYear)

startYear

Type: string || number

returns

Type: string


Related


License

MIT © Dawson Botsford