Wondering what’s next for npm?Check out our public roadmap! »

date-fns-duration

1.0.4 • Public • Published

data-fns-duration

Complementary package for date-fns to add/subtract ISO 8601 durations to/from dates.

Installation

Install it alongside date-fns

npm i -S date-fns-duration

API

 
import addDuration from 'date-fns-duration';
 
// addDuration(date, duration);
 
// Add duration
const two_hours_from_now = addDuration(Date.now(), "PT2H");
 
// Subtract duration
const month_before = addDuration("2018-10-02T10:00", "-P1M");
 

Install

npm i date-fns-duration

DownloadsWeekly Downloads

901

Version

1.0.4

License

MIT

Unpacked Size

2.22 kB

Total Files

3

Last publish

Collaborators

  • avatar