/daysleft

A module for getting the days left until a given date

Primary LanguageJavaScriptMIT LicenseMIT

daysleft Build Status

A module for getting the days left until a given date

Install

$ npm install --save daysleft

Usage

Using string

/* Assuming 'today' is 12/24/2017 */
import daysleft from 'daysleft';

const christmas = '12/25/2017';
daysleft(christmas);
//=> '1'

Using moment

/* Assuming 'today' is 12/24/2017 */
import moment from 'moment';
import daysleft from 'daysleft';

const christmas = moment('12/25/2017');
daysleft(christmas);
//=> '1'

API

daysleft(date, {options})

date

Type: string or moment
Examples: '12/24/2017' or moment('12/24/2017')

options

startDate

Type: string or moment
Default: today
Examples: '12/24/2017' or moment('12/24/2017')

Allows you to provide a different start date other than 'today'

Related

License

MIT © Quinton Bolt