Skip to content
/ daysleft Public

A module for getting the days left until a given date

License

Notifications You must be signed in to change notification settings

qbolt/daysleft

Repository files navigation

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

About

A module for getting the days left until a given date

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published