Skip to content

watsondg/has-date-expired

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

has-date-expired

Sane way to know if a date has expired or not.

Install

npm install watsondg/has-date-expired -S

Usage

var hasExpired = require('has-date-expired');

var season = hasExpired('06/20/2016') ? 'summer' : 'spring';
var isNoon = hasExpired('06/20/2016 12:00:00');

Methods

hasExpired(date[, format])

Return true if the input date has expired, false otherwise. Calculated with Date.now().

  • date (DATE[ TIME]) - The target date. Date components are separated by slashes. Time components (optional) are separated by colons. Shorthands work too (i.e. year can be on 2 or 4 digits).
  • format - (OPTIONAL) - 3 letters, in any order, 'YMD' to represent the order of Year, Month and Day. Defaults to MDY. Note that time format is always 0-23.

License

MIT.

About

Sane way to know if a date has expired or not.

Resources

License

Stars

Watchers

Forks

Packages

No packages published